[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6AD1P7F6P5AXJFVVG85Z4M7":3,"skill-same:01M6AD1P7F6P5AXJFVVG85Z4M7":141},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":42,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":6,"updatedAt":45,"install":46,"resources":59},"01M6AD1P7F6P5AXJFVVG85Z4M7","osgi-scr-migrator",null,"Migrate OSGi-based Java projects from deprecated Felix SCR annotations to official OSGi R6\u002FR7 Component annotations. Use when migrating legacy OSGi bundles that use @Component, @Service, @Reference, @Property from org.apache.felix.scr.annotations to org.osgi.service.component.annotations. Handles both Java source code transformation and Maven POM updates (removing maven-scr-plugin, updating dependencies). Also supports Sling-specific annotations like @SlingServlet and @SlingFilter. Features full automation of property migration, metatype configuration generation, constructor injection optimization, validation, and comprehensive reporting. After basic migration, offers optional Step 7 to optimize code with constructor injection for immutable dependencies.","apache\u002Fsling-agent-skills","apache","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47359?v=4","01M6AC83E6K4FDKK7HZ8WNMQKE","The Apache Software Foundation","01M6AD1M9S2K8GV5EXRYQTBDW0",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[24,25,26,27,28,29,30,9,31],"osgi scr migrator","automation","component","official","plugin","code","validation","java","2026-11-10 10:12:30",false,"---\nname: osgi-scr-migrator\ndescription: Migrate OSGi-based Java projects from deprecated Felix SCR annotations to official OSGi R6\u002FR7 Component annotations. Use when migrating legacy OSGi bundles that use @Component, @Service, @Reference, @Property from org.apache.felix.scr.annotations to org.osgi.service.component.annotations. Handles both Java source code transformation and Maven POM updates (removing maven-scr-plugin, updating dependencies). Also supports Sling-specific annotations like @SlingServlet and @SlingFilter. Features full automation of property migration, metatype configuration generation, constructor injection optimization, validation, and comprehensive reporting. After basic migration, offers optional Step 7 to optimize code with constructor injection for immutable dependencies.\n---\n\n# OSGi SCR to R6\u002FR7 Migration (Enhanced)\n\nAutomate complete migration from deprecated Felix SCR annotations to official OSGi R6\u002FR7 Component annotations with full property migration, metatype support, and validation.\n\n## Overview\n\nFelix SCR (Service Component Runtime) annotations (`org.apache.felix.scr.annotations.*`) were deprecated and replaced by official OSGi R6 annotations (`org.osgi.service.component.annotations.*`). This skill provides fully automated tools and guidance for complete migration with minimal manual intervention.\n\n## Key Features\n\n- **Full @Property Migration**: Automatically converts all @Property annotations with proper type specifications (:Integer, :Boolean, etc.)\n- **Service Property Type Annotations**: Automatically uses `@ServiceRanking`, `@ServiceDescription`, and `@ServiceVendor` from `org.osgi.service.component.propertytypes` package (requires `org.osgi:org.osgi.service.component` dependency) for standard service properties (preferred over property strings)\n- **Component Property Types**: Generates type-safe configuration interfaces (OSGi R7 best practice)\n  - Automatically converts `Map\u003CString, Object>` to `Config` annotation interfaces\n  - No more manual type conversion with PropertiesUtil\n  - Type-safe, IDE-friendly configuration access\n- **Metatype Configuration**: Detects and generates complete @Designate and @ObjectClassDefinition interfaces with full metadata preservation\n  - Captures @Component label\u002Fdescription → @ObjectClassDefinition name\u002Fdescription\n  - Captures @Property label\u002Fdescription → @AttributeDefinition name\u002Fdescription\n  - Updates @Activate\u002F@Modified methods to use Config type\n- **Sling Annotations**: Fully automates @SlingServlet and @SlingFilter transformations\n- **Constructor Injection Optimization** (Optional Step 7): Automatically migrates components to use constructor injection for immutable dependencies\n  - Moves `@Activate(Config config)` to constructor injection\n  - Migrates mandatory static unary `@Reference` fields to constructor parameters\n  - Makes fields `final` for immutability and thread safety\n  - Preserves optional\u002Fdynamic\u002Fmultiple references as field injection\n- **Enforced Versions**: Uses latest stable versions (component annotations 1.5.1, metatype 1.4.1)\n- **Validation**: Built-in validation checks for migration completeness\n- **Comprehensive Reporting**: Detailed statistics and warnings for all migrations\n- **Version Control Friendly**: No backup files created - use git or other SCM for change tracking\n\n## When to Use\n\n- Migrating legacy OSGi bundles using Felix SCR annotations\n- Upgrading to OSGi R6\u002FR7 standards\n- Modernizing AEM\u002FSling projects\n- Preparing projects for newer OSGi runtime versions\n- Removing maven-scr-plugin dependency\n\n## Prerequisites\n\nBefore using this migration skill, ensure you have:\n\n- **Python 3.7+** - Required to run the migration scripts\n- **Java 17+** - Required for compiling the migrated code (OSGi R6\u002FR7 annotations require Java 17+)\n- **Maven or Gradle** - For building and testing the project\n- **Version Control** - Git or similar (required for rollback capability)\n\n**Note**: The migrated code will use OSGi R6\u002FR7 Component annotations which require Java 17 or higher. Projects on older Java versions must upgrade to Java 17+ as part of this migration.\n\n## Migration Workflow\n\n### Step 1: Assessment and Preparation\n\n**IMPORTANT**: Before migration, commit all your code to git or another version control system. The migration scripts modify files directly without creating backups.\n\n```bash\n# Ensure code is committed\ngit status\ngit add .\ngit commit -m \"Pre-OSGi migration snapshot\"\n\n# Find files with SCR annotations\ngrep -r \"org.apache.felix.scr.annotations\" --include=\"*.java\" .\n\n# Check POM dependencies\ngrep -r \"felix.scr.annotations\" --include=\"pom.xml\" .\n\n# Count components to migrate\ngrep -r \"@Component\" --include=\"*.java\" . | wc -l\n```\n\nCreate a backup or ensure code is in version control before proceeding.\n\n### Step 2: Run Automated Migration\n\nUse the enhanced migration scripts for fully automated transformation:\n\n#### 2a. Migrate Java Annotations (Enhanced)\n\n```bash\n# Dry run to preview changes\npython3 scripts\u002Fmigrate_annotations.py \u002Fpath\u002Fto\u002Fsrc --dry-run\n\n# Apply changes with validation\npython3 scripts\u002Fmigrate_annotations.py \u002Fpath\u002Fto\u002Fsrc --validate\n\n# Tip: Commit to git before running to easily review\u002Frevert changes\ngit add . && git commit -m \"Pre-migration snapshot\"\n```\n\nThe enhanced script handles:\n- Import statement updates\n- `@Component` attribute transformation with property merging\n- `@Service` merging into `@Component`\n- `@Reference` cardinality updates (OPTIONAL_UNARY → OPTIONAL, etc.)\n- **Full `@Property` migration** with type specifications\n- **Automatic metatype configuration generation** for configurable components\n- **Complete `@SlingServlet` transformation** to @Component with servlet properties\n- **Complete `@SlingFilter` transformation** to @Component with filter properties\n- Lifecycle annotation imports (`@Activate`, `@Deactivate`, `@Modified`)\n- Validation and comprehensive reporting\n\n#### 2b. Migrate POM Files (Enhanced)\n\n```bash\n# Dry run to preview changes\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --dry-run\n\n# Apply changes with automatic metatype detection\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --auto-detect-metatype\n\n# Apply with validation\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --validate\n```\n\nThe enhanced script handles:\n- Removing `maven-scr-plugin` from all locations\n- Removing `org.apache.felix.scr.annotations` dependency\n- Adding `org.osgi.service.component.annotations` dependency (version **1.5.1** enforced) **at the beginning of the dependency list**\n- **Smart version detection** from existing OSGi dependencies\n- **Automatic metatype dependency addition** when detected (version **1.4.1** enforced) **placed after component annotations**\n- Ensuring OSGi bundle plugin (`maven-bundle-plugin` or `bnd-maven-plugin`) uses `extensions=true`\n- Removing obsolete SCR-specific plugin instructions\n- Pretty-printing XML with proper indentation\n- Validation and detailed reporting\n\n### Step 3: Review Migration Results\n\nThe scripts now provide comprehensive statistics:\n\n```\n======================================================================\nMIGRATION SUMMARY\n======================================================================\nFiles processed:              15\nFiles changed:                12\n@Component annotations:       45\n@Service merged:              38\n@Reference updated:           27\n@Property migrated:           156\n@SlingServlet migrated:       8\n@SlingFilter migrated:        3\nMetatype configs generated:   12\nImport statements updated:    180\n\nWarnings: 2\n  ⚠ MyService.java: Consider reviewing generated metatype configuration\n  ⚠ OtherService.java: Manual review recommended for complex property\n\nErrors: 0\n======================================================================\n```\n\n### Step 4: Advanced Features\n\n#### Metatype Configuration with Component Property Types (Fully Automated)\n\nFor components with `metatype = true`, the script automatically generates complete metatype configurations using **Component Property Types** (OSGi R7's preferred approach):\n\n- **@Component label\u002Fdescription** → **@ObjectClassDefinition name\u002Fdescription**\n- **@Property label\u002Fdescription** → **@AttributeDefinition name\u002Fdescription**\n- **@Activate(Map\u003CString, Object>)** → **@Activate(Config)** for type-safe access\n\n```java\n\u002F\u002F Before - Using deprecated Map approach\n@Component(metatype = true, label = \"My Service\", description = \"This is my service\")\n@Property(name = \"timeout\", intValue = 30, label = \"Timeout\", description = \"Request timeout in seconds\")\npublic class MyService {\n    @Activate\n    private void activate(Map\u003CString, Object> props) {\n        int timeout = PropertiesUtil.toInteger(props.get(\"timeout\"), 30);\n    }\n}\n\n\u002F\u002F After - Using Component Property Types (automatically generated)\n@Component\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\", description = \"This is my service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\", description = \"Request timeout in seconds\")\n        int timeout() default 30;\n    }\n\n    @Activate\n    private void activate(Config config) {\n        \u002F\u002F Type-safe, no conversion needed!\n        int timeout = config.timeout();\n    }\n}\n```\n\n**Why Component Property Types?**\n- ✅ **Type-safe**: No runtime type conversion errors\n- ✅ **Cleaner**: No PropertiesUtil or manual conversions\n- ✅ **IDE-friendly**: Auto-completion for configuration properties\n- ✅ **Maintainable**: Changes to config structure caught at compile-time\n- ✅ **OSGi R7 standard**: Modern best practice\n\n**Note:** The migration automatically:\n1. Captures all label\u002Fdescription metadata from @Component and @Property\n2. Generates the Config annotation interface\n3. Updates @Activate\u002F@Modified methods to use the Config type instead of Map\n\nThe POM is automatically updated with the OSGi annotations and metatype dependencies using the latest versions:\n```xml\n\u003Cdependency>\n    \u003CgroupId>org.osgi\u003C\u002FgroupId>\n    \u003CartifactId>org.osgi.service.component.annotations\u003C\u002FartifactId>\n    \u003Cversion>1.5.1\u003C\u002Fversion>\n    \u003Cscope>provided\u003C\u002Fscope>\n\u003C\u002Fdependency>\n\u003Cdependency>\n    \u003CgroupId>org.osgi\u003C\u002FgroupId>\n    \u003CartifactId>org.osgi.service.component\u003C\u002FartifactId>\n    \u003Cversion>1.5.1\u003C\u002Fversion>\n    \u003Cscope>provided\u003C\u002Fscope>\n\u003C\u002Fdependency>\n\u003Cdependency>\n    \u003CgroupId>org.osgi\u003C\u002FgroupId>\n    \u003CartifactId>org.osgi.service.metatype.annotations\u003C\u002FartifactId>\n    \u003Cversion>1.4.1\u003C\u002Fversion>\n    \u003Cscope>provided\u003C\u002Fscope>\n\u003C\u002Fdependency>\n```\n\n**Important**: This migration skill enforces the latest stable versions:\n- **org.osgi.service.component.annotations: 1.5.1** (required - provides @Component, @Reference, etc.)\n- **org.osgi.service.component: 1.5.1** (required - provides property type annotations like @ServiceDescription, @ServiceRanking, @ServiceVendor)\n- **org.osgi.service.metatype.annotations: 1.4.1** (required when metatype is used)\n\n**Automatic for Sling Projects**: When Sling servlets\u002Ffilters are detected:\n- **org.apache.sling.servlets.annotations: 1.2.6** (automatically added, provides type-safe Sling annotations)\n\nThese versions are required for proper OSGi R6\u002FR7 compatibility.\n\n#### Sling Annotations (Fully Automated)\n\nSling servlets and filters are completely automated. The migration uses type-safe Sling Servlets Annotations:\n\n```java\n\u002F\u002F Before\n@SlingServlet(\n    paths = \"\u002Fbin\u002Fmyservlet\",\n    methods = {\"GET\", \"POST\"},\n    extensions = {\"html\", \"json\"}\n)\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n\n\u002F\u002F After (automatically generated)\nimport org.apache.sling.servlets.annotations.SlingServletPaths;\nimport org.osgi.service.component.annotations.Component;\nimport javax.servlet.Servlet;\n\n@Component(service = Servlet.class)\n@SlingServletPaths(value = \"\u002Fbin\u002Fmyservlet\")\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n```\n\n**Path-based servlets** use `@SlingServletPaths`:\n```java\n@Component(service = Servlet.class)\n@SlingServletPaths(value = {\"\u002Fbin\u002Fservlet1\", \"\u002Fbin\u002Fservlet2\"})\n```\n\n**Resource-type-based servlets** use `@SlingServletResourceTypes`:\n```java\n@Component(service = Servlet.class)\n@SlingServletResourceTypes(\n    resourceTypes = \"my\u002Fresource\u002Ftype\",\n    selectors = \"print\",\n    extensions = {\"html\", \"pdf\"},\n    methods = {\"GET\", \"POST\"}\n)\n```\n\n**Filters** use `@SlingServletFilter`:\n```java\n@Component(service = Filter.class)\n@SlingServletFilter(\n    scope = SlingServletFilterScope.REQUEST,\n    order = -700,\n    pattern = \"\u002Fcontent\u002F.*\"\n)\n```\n\nThe migration automatically:\n- Detects Sling servlet\u002Ffilter usage in your Java files\n- Adds the `org.apache.sling.servlets.annotations:1.2.6` dependency to your POM\n- Transforms annotations to use the type-safe Sling Servlets Annotations format\n- Updates all necessary imports\n\nSee [references\u002Fannotation-mappings.md](references\u002Fannotation-mappings.md) for detailed examples of all Sling annotation transformations.\n\n### Step 5: Build and Test\n\n```bash\n# Clean and build\nmvn clean install\n\n# Run tests\nmvn test\n\n# Verify bundle activation\n# The migration scripts include validation to catch common issues\n```\n\n### Step 6: Run Validation\n\n```bash\n# Validate Java migrations\npython3 scripts\u002Fmigrate_annotations.py \u002Fpath\u002Fto\u002Fsrc --validate\n\n# Validate POM migrations\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --validate\n\n# Run comprehensive test suite\nbash scripts\u002Ftests\u002Frun_tests.sh\n```\n\n**✅ Basic migration complete!** If all tests pass, proceed to Step 7 for optional constructor injection optimization.\n\n---\n\n## ✨ Optional Post-Migration Optimization\n\nOnce the basic migration (Steps 1-6) is complete and all tests pass, consider **Step 7** below to further modernize your code with constructor injection.\n\n---\n\n### Step 7: Optimize with Constructor Injection (Automated, Optional)\n\n**⚠️ IMPORTANT**: Run this step AFTER completing Steps 1-6 and ensuring all tests pass.\n\nAutomatically optimize your code with modern OSGi best practices using **constructor injection**. This step is optional but highly recommended for cleaner, more maintainable code.\n\n**NEW**: This step is now fully automated using the `migrate_constructor_injection.py` script!\n\n#### Quick Start - Run the Migration\n\n```bash\n# Preview changes (dry-run) - RECOMMENDED FIRST\npython3 scripts\u002Fmigrate_constructor_injection.py \u002Fpath\u002Fto\u002Fsrc --dry-run\n\n# Apply migration with validation\npython3 scripts\u002Fmigrate_constructor_injection.py \u002Fpath\u002Fto\u002Fsrc --validate\n\n# Single file migration\npython3 scripts\u002Fmigrate_constructor_injection.py \u002Fpath\u002Fto\u002FMyService.java\n\n# Tip: Always commit to git before running\ngit add . && git commit -m \"Pre-constructor-injection snapshot\"\n```\n\n#### Benefits of Constructor Injection\n\n- ✅ **Immutability**: Dependencies declared as `final` fields\n- ✅ **Explicit Dependencies**: All dependencies visible in constructor signature\n- ✅ **Thread Safety**: Immutable references eliminate race conditions\n- ✅ **Testability**: Easier to mock dependencies in unit tests\n- ✅ **Modern Best Practice**: Aligned with OSGi R7\u002FR8 recommendations\n\n#### 7a. Constructor Injection for Configurations\n\nInstead of using `@Activate` methods to receive configuration, inject it directly in the constructor:\n\n```java\n\u002F\u002F After basic migration (Step 2)\n@Component\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\")\n        int timeout() default 30;\n\n        @AttributeDefinition(name = \"Max Retries\")\n        int maxRetries() default 3;\n    }\n\n    private int timeout;\n    private int maxRetries;\n\n    @Activate\n    private void activate(Config config) {\n        this.timeout = config.timeout();\n        this.maxRetries = config.maxRetries();\n    }\n}\n\n\u002F\u002F After optimization (Step 7)\n@Component\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\")\n        int timeout() default 30;\n\n        @AttributeDefinition(name = \"Max Retries\")\n        int maxRetries() default 3;\n    }\n\n    private final int timeout;\n    private final int maxRetries;\n\n    @Activate\n    public MyService(Config config) {\n        this.timeout = config.timeout();\n        this.maxRetries = config.maxRetries();\n    }\n}\n```\n\n**Key changes:**\n- Constructor is now `public` (OSGi requirement for constructor injection)\n- Configuration fields are `final` (immutable)\n- No separate `@Activate` method needed\n- Configuration is available immediately upon construction\n\n#### 7b. Constructor Injection for Unary Static Mandatory References\n\nFor references that are:\n- **Mandatory** (not optional)\n- **Static** (not dynamic)\n- **Unary** (single reference, not multiple)\n\nUse constructor injection to make dependencies explicit and immutable:\n\n```java\n\u002F\u002F After basic migration (Step 2) - Field injection\n@Component(service = MyService.class)\npublic class MyService {\n\n    @Reference\n    private ResourceResolverFactory resolverFactory;\n\n    @Reference\n    private SlingRepository repository;\n\n    @Reference(cardinality = ReferenceCardinality.OPTIONAL)\n    private ConfigurationAdmin configAdmin;  \u002F\u002F Optional - keep as field\n\n    public void doSomething() {\n        \u002F\u002F Use resolverFactory and repository\n    }\n}\n\n\u002F\u002F After optimization (Step 7) - Constructor injection for mandatory references\n@Component(service = MyService.class)\npublic class MyService {\n\n    private final ResourceResolverFactory resolverFactory;\n    private final SlingRepository repository;\n\n    \u002F\u002F Optional reference stays as field injection\n    @Reference(cardinality = ReferenceCardinality.OPTIONAL)\n    private ConfigurationAdmin configAdmin;\n\n    @Activate\n    public MyService(\n        @Reference ResourceResolverFactory resolverFactory,\n        @Reference SlingRepository repository\n    ) {\n        this.resolverFactory = resolverFactory;\n        this.repository = repository;\n    }\n\n    public void doSomething() {\n        \u002F\u002F Use resolverFactory and repository (guaranteed non-null)\n    }\n}\n```\n\n**When to use constructor injection for references:**\n- ✅ Mandatory references (`cardinality = MANDATORY` or no cardinality specified)\n- ✅ Static references (`policy = STATIC` or no policy specified)\n- ✅ Unary references (single service, not collections)\n\n**When to keep field injection:**\n- ❌ Optional references (`cardinality = OPTIONAL`)\n- ❌ Dynamic references (`policy = DYNAMIC`)\n- ❌ Multiple references (`cardinality = MULTIPLE` or `AT_LEAST_ONE`)\n- ❌ References with custom bind\u002Funbind methods\n\n#### 7c. Combined Configuration and References\n\nYou can combine configuration and reference injection in a single constructor:\n\n```java\n\u002F\u002F Optimized: Constructor injection for config + mandatory static references\n@Component(service = MyService.class)\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\")\n        int timeout() default 30;\n    }\n\n    private final int timeout;\n    private final ResourceResolverFactory resolverFactory;\n    private final SlingRepository repository;\n\n    \u002F\u002F Optional\u002Fdynamic references stay as field injection\n    @Reference(cardinality = ReferenceCardinality.OPTIONAL)\n    private ConfigurationAdmin configAdmin;\n\n    @Activate\n    public MyService(\n        Config config,\n        @Reference ResourceResolverFactory resolverFactory,\n        @Reference SlingRepository repository\n    ) {\n        this.timeout = config.timeout();\n        this.resolverFactory = resolverFactory;\n        this.repository = repository;\n    }\n}\n```\n\n**Important notes:**\n- Configuration parameter (if present) must be **first** in constructor\n- Reference parameters follow after configuration\n- Constructor must be `public` for OSGi to inject dependencies\n- Use `@Reference` annotation on each reference parameter\n- Reference attributes (target, cardinality, etc.) can be specified on parameters\n\n#### 7d. What the Script Does Automatically\n\nThe script automatically:\n- ✅ Identifies components with `@Activate(Config config)` methods\n- ✅ Identifies mandatory static unary `@Reference` fields\n- ✅ Creates public constructor with `@Activate` annotation\n- ✅ Moves config parameter to constructor (first parameter)\n- ✅ Moves eligible references to constructor parameters\n- ✅ Makes fields `final` for immutability\n- ✅ Preserves optional\u002Fdynamic\u002Fmultiple references as field injection\n- ✅ Generates comprehensive migration statistics\n\n**What the script does NOT migrate** (kept as field injection):\n- ❌ Optional references (`cardinality = OPTIONAL`)\n- ❌ Dynamic references (`policy = DYNAMIC`)\n- ❌ Multiple references (`cardinality = MULTIPLE` or `AT_LEAST_ONE`)\n- ❌ References with custom bind\u002Funbind methods\n- ❌ Collection references (List, Set, Collection)\n\n#### 7e. Post-Migration Verification\n\nAfter running the automated migration, verify the changes:\n\n1. **Review the migration statistics**:\n   ```\n   ======================================================================\n   CONSTRUCTOR INJECTION MIGRATION SUMMARY\n   ======================================================================\n   Files processed:              15\n   Files changed:                8\n   Components migrated:          8\n   Configs converted:            6\n   References converted:         14\n   Fields made final:            20\n   ======================================================================\n   ```\n\n2. **Test thoroughly**:\n   ```bash\n   mvn clean install\n   mvn test\n   ```\n\n3. **Verify OSGi activation**:\n   - Check OSGi console for component activation\n   - Verify all references are satisfied\n   - Test component functionality\n\n4. **Review generated constructors**:\n   - Constructor is `public` ✓\n   - `@Activate` annotation on constructor ✓\n   - Config parameter is first (if present) ✓\n   - Only mandatory static unary references moved to constructor ✓\n   - Optional\u002Fdynamic references remain as fields ✓\n   - Fields are `final` where appropriate ✓\n\n**If tests fail**: Use `git diff` to review changes and `git checkout .` to revert if needed.\n\n## Advanced Usage\n\n### Command-Line Options\n\n#### Constructor Injection Migration Script (Step 7)\n\n```bash\npython3 scripts\u002Fmigrate_constructor_injection.py [OPTIONS] PATH\n\nOptions:\n  --dry-run          Preview changes without modifying files\n  --validate         Validate migrated code for common issues\n\nExamples:\n  # Preview all changes\n  python3 scripts\u002Fmigrate_constructor_injection.py src\u002F --dry-run\n\n  # Migrate with validation\n  python3 scripts\u002Fmigrate_constructor_injection.py src\u002F --validate\n\n  # Single file migration\n  python3 scripts\u002Fmigrate_constructor_injection.py src\u002Fmain\u002Fjava\u002FMyService.java\n\n  # Use git to review changes\n  git diff src\u002F\n```\n\n#### Java Migration Script (Step 2)\n\n```bash\npython3 scripts\u002Fmigrate_annotations.py [OPTIONS] PATH\n\nOptions:\n  --dry-run          Preview changes without modifying files\n  --validate         Validate migrated code for common issues\n\nExamples:\n  # Preview all changes\n  python3 scripts\u002Fmigrate_annotations.py src\u002F --dry-run\n\n  # Migrate with validation\n  python3 scripts\u002Fmigrate_annotations.py src\u002F --validate\n\n  # Use git to review changes\n  git diff src\u002F\n```\n\n#### POM Migration Script\n\n```bash\npython3 scripts\u002Fmigrate_pom.py [OPTIONS] PATH\n\nOptions:\n  --dry-run              Preview changes without modifying files\n  --validate             Validate migrated POMs\n  --add-metatype         Add metatype dependency\n  --auto-detect-metatype Auto-detect metatype usage from Java files\n  --detect-versions      Detect OSGi versions from existing deps (default: True)\n\nExamples:\n  # Migrate with automatic metatype detection\n  python3 scripts\u002Fmigrate_pom.py . --auto-detect-metatype\n\n  # Dry run with validation\n  python3 scripts\u002Fmigrate_pom.py . --dry-run --validate\n\n  # Use git to review changes\n  git diff pom.xml\n```\n\n### Testing\n\nThe skill includes comprehensive unit tests:\n\n```bash\n# Run all tests\nbash scripts\u002Ftests\u002Frun_tests.sh\n\n# Run Java migration tests\npython3 scripts\u002Ftests\u002Ftest_migrate_annotations.py\n\n# Run POM migration tests\npython3 scripts\u002Ftests\u002Ftest_migrate_pom.py\n\n# Run constructor injection migration tests\npython3 scripts\u002Ftests\u002Ftest_migrate_constructor_injection.py\n```\n\nTest coverage includes:\n- Property parsing and conversion\n- Metatype configuration generation\n- Sling annotation transformation\n- Reference cardinality migration\n- Complete file migration scenarios\n- POM plugin and dependency updates\n- Version detection\n- Statistics tracking\n- **Constructor injection migration** (config and reference conversion)\n- **Reference eligibility detection** (mandatory\u002Foptional, static\u002Fdynamic)\n- **Field final modifier addition**\n\n## Migration Patterns\n\n### Pattern 1: Basic Component with Properties\n\n```java\n\u002F\u002F Before\n@Component(immediate = true)\n@Service\n@Property(name = \"service.vendor\", value = \"Apache Software Foundation\")\n@Property(name = \"service.ranking\", intValue = 100)\npublic class MyService implements SomeInterface {\n}\n\n\u002F\u002F After (fully automated)\n@Component(\n    immediate = true,\n    service = SomeInterface.class,\n    property = {\n        \"service.vendor=Apache Software Foundation\",\n        \"service.ranking:Integer=100\"\n    }\n)\npublic class MyService implements SomeInterface {\n}\n```\n\n### Pattern 2: Configurable Component with Component Property Types\n\n```java\n\u002F\u002F Before - Using deprecated Map approach\n@Component(metatype = true, immediate = true, label = \"My Service\", description = \"Service description\")\n@Property(name = \"timeout\", intValue = 30, label = \"Timeout\", description = \"Request timeout\")\n@Property(name = \"retries\", intValue = 3, label = \"Retries\", description = \"Number of retries\")\npublic class MyService {\n    @Activate\n    private void activate(Map\u003CString, Object> props) {\n        int timeout = PropertiesUtil.toInteger(props.get(\"timeout\"), 30);\n        int retries = PropertiesUtil.toInteger(props.get(\"retries\"), 3);\n    }\n}\n\n\u002F\u002F After - Using Component Property Types (fully automated, type-safe)\n@Component(immediate = true)\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\", description = \"Service description\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\", description = \"Request timeout\")\n        int timeout() default 30;\n\n        @AttributeDefinition(name = \"Retries\", description = \"Number of retries\")\n        int retries() default 3;\n    }\n\n    @Activate\n    private void activate(Config config) {\n        \u002F\u002F Type-safe access - no conversion utilities needed!\n        int timeout = config.timeout();\n        int retries = config.retries();\n    }\n}\n```\n\n**Note**: Component Property Types are the OSGi R7 best practice and are automatically generated by the migration.\n\n### Pattern 3: Sling Servlet\n\n```java\n\u002F\u002F Before\n@SlingServlet(\n    resourceTypes = \"my\u002Fresource\u002Ftype\",\n    selectors = {\"print\", \"pdf\"},\n    extensions = \"html\"\n)\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n\n\u002F\u002F After (fully automated using Sling Servlets Annotations)\nimport org.apache.sling.servlets.annotations.SlingServletResourceTypes;\nimport org.osgi.service.component.annotations.Component;\nimport javax.servlet.Servlet;\n\n@Component(service = Servlet.class)\n@SlingServletResourceTypes(\n    resourceTypes = \"my\u002Fresource\u002Ftype\",\n    selectors = {\"print\", \"pdf\"},\n    extensions = \"html\"\n)\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n```\n\n## Reference Documentation\n\nFor comprehensive annotation mappings and examples:\n\n```bash\n# View complete mapping reference\ncat references\u002Fannotation-mappings.md\n```\n\nThis includes:\n- All annotation transformations with before\u002Fafter examples\n- Cardinality and policy mappings\n- Property type specifications\n- Sling annotation patterns\n- Common migration patterns\n\n## Troubleshooting\n\n### Components Not Activating\n\nCheck:\n- `service` attribute properly set in `@Component`\n- All required dependencies satisfied\n- No compilation errors\n- Run validation: `python3 scripts\u002Fmigrate_annotations.py src\u002F --validate`\n\n### Configuration Not Working\n\n- Verify metatype annotations are present\n- Check `@Designate` links to correct config interface\n- Ensure activate method signature matches config type\n- POM contains metatype dependency (auto-added with `--auto-detect-metatype`)\n\n### Build Failures\n\n- Ensure OSGi bundle plugin (`maven-bundle-plugin` or `bnd-maven-plugin`) has `extensions=true` (auto-fixed)\n- Verify all OSGi annotation dependencies are present (auto-added)\n- Run POM validation: `python3 scripts\u002Fmigrate_pom.py . --validate`\n- Check migration summary for errors and warnings\n\n### Migration Issues\n\nIf you encounter any issues:\n\n1. **Review the statistics**: The summary shows exactly what was changed\n2. **Check warnings**: The script flags items that may need review\n3. **Use dry-run**: Preview changes before applying them\n4. **Run tests**: Use the included test suite to verify migration logic\n5. **Validate**: Use `--validate` flag to check for common issues\n\n## Performance\n\nThe enhanced migration scripts are optimized for large codebases:\n\n- Processes hundreds of files per second\n- Memory-efficient line-by-line processing\n- Parallel processing support (via multiple script invocations)\n- Progress reporting for large projects\n\nExample performance:\n- 500 Java files: ~30 seconds\n- 1000 Java files: ~1 minute\n- 50 POM files: ~5 seconds\n\n## What's New in Enhanced Version\n\n### Version 2.1 Features (Latest)\n\n- ✅ **Constructor Injection Automation**: NEW! Automated Step 7 optimization for modern OSGi best practices\n- ✅ **Immutable Dependencies**: Automatically makes fields `final` when migrated to constructor\n- ✅ **Smart Reference Detection**: Identifies eligible vs ineligible references for constructor injection\n- ✅ **Config Parameter Migration**: Moves `@Activate(Config config)` to constructor injection\n\n### Version 2.0 Features\n\n- ✅ **Full Property Migration**: Complete automation of @Property transformations\n- ✅ **Metatype Generation**: Automatic configuration interface creation\n- ✅ **Sling Automation**: Complete @SlingServlet and @SlingFilter migration\n- ✅ **Smart Version Detection**: Automatic OSGi version inference\n- ✅ **Comprehensive Validation**: Built-in checks for migration quality\n- ✅ **Detailed Reporting**: Statistics and warnings for all operations\n- ✅ **Test Suite**: Comprehensive unit and integration tests\n- ✅ **Error Recovery**: Graceful handling of edge cases\n\n### Improvements Over Original\n\n| Feature | Original | Enhanced | v2.1 |\n|---------|----------|----------|------|\n| @Property Migration | TODO comments | Fully automated | ✓ |\n| Metatype Support | Manual | Auto-generated | ✓ |\n| Sling Annotations | TODO comments | Fully automated | ✓ |\n| Constructor Injection | Not available | Manual guidance | **Fully automated** |\n| Validation | None | Comprehensive | ✓ |\n| Reporting | Basic | Detailed stats | ✓ |\n| Testing | None | Full test suite | Enhanced |\n| Version Detection | Hardcoded | Smart detection | ✓ |\n| Error Handling | Basic | Robust | ✓ |\n\n## Additional Resources\n\n- OSGi Compendium Specification: Component annotations (Chapter 112)\n- Apache Felix SCR documentation\n- Sling development documentation for servlet\u002Ffilter annotations\n- Apache Sling Servlets Annotations: https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-org-apache-sling-servlets-annotations\n- Test suite: `scripts\u002Ftests\u002F`\n- Example transformations: `references\u002Fannotation-mappings.md`\n\n## Sling-Specific Features\n\nFor **Apache Sling projects**, the migration provides full automation:\n\n1. **Automatic Detection**: The migration automatically detects Sling servlet and filter usage by scanning your Java files for:\n   - `@SlingServlet` annotations\n   - `@SlingFilter` annotations\n   - Existing `@SlingServletPaths`, `@SlingServletResourceTypes`, or `@SlingServletFilter` annotations\n\n2. **Dependency Management**: When Sling usage is detected, the migration automatically:\n   - Adds the `org.apache.sling.servlets.annotations:1.2.6` dependency to your POM\n   - Places it after OSGi component and metatype dependencies\n   - Sets the correct scope (`provided`)\n\n3. **Type-Safe Transformations**: The migration uses type-safe Sling Servlets Annotations:\n   - `@SlingServletPaths` for path-based servlets\n   - `@SlingServletResourceTypes` for resource-type-based servlets with selectors, extensions, and methods\n   - `@SlingServletFilter` for filters with scope, order, and pattern\n\n   This provides better IDE support, compile-time validation, and improved readability compared to property strings.\n\nSee [Sling annotation examples](references\u002Fannotation-mappings.md#sling-annotations) for detailed transformation syntax.\n\n## Notes\n\n- The migration scripts now handle **98%+ of migrations automatically** (including Step 7 constructor injection!)\n- Manual review is only needed for very complex edge cases\n- Always test in a development environment before production deployment\n- **Java 17+ is required** for OSGi R6\u002FR7 Component annotations (this is a prerequisite, not optional)\n- Run the test suite to verify migration logic: `bash scripts\u002Ftests\u002Frun_tests.sh`\n- Some runtime behavior may differ subtly between SCR and R6+ implementations\n- **Step 7 is optional** but recommended - the automated script makes it easy and safe to apply\n","# OSGi SCR to R6\u002FR7 Migration (Enhanced)\n\nAutomate complete migration from deprecated Felix SCR annotations to official OSGi R6\u002FR7 Component annotations with full property migration, metatype support, and validation.\n\n## Overview\n\nFelix SCR (Service Component Runtime) annotations (`org.apache.felix.scr.annotations.*`) were deprecated and replaced by official OSGi R6 annotations (`org.osgi.service.component.annotations.*`). This skill provides fully automated tools and guidance for complete migration with minimal manual intervention.\n\n## Key Features\n\n- **Full @Property Migration**: Automatically converts all @Property annotations with proper type specifications (:Integer, :Boolean, etc.)\n- **Service Property Type Annotations**: Automatically uses `@ServiceRanking`, `@ServiceDescription`, and `@ServiceVendor` from `org.osgi.service.component.propertytypes` package (requires `org.osgi:org.osgi.service.component` dependency) for standard service properties (preferred over property strings)\n- **Component Property Types**: Generates type-safe configuration interfaces (OSGi R7 best practice)\n  - Automatically converts `Map\u003CString, Object>` to `Config` annotation interfaces\n  - No more manual type conversion with PropertiesUtil\n  - Type-safe, IDE-friendly configuration access\n- **Metatype Configuration**: Detects and generates complete @Designate and @ObjectClassDefinition interfaces with full metadata preservation\n  - Captures @Component label\u002Fdescription → @ObjectClassDefinition name\u002Fdescription\n  - Captures @Property label\u002Fdescription → @AttributeDefinition name\u002Fdescription\n  - Updates @Activate\u002F@Modified methods to use Config type\n- **Sling Annotations**: Fully automates @SlingServlet and @SlingFilter transformations\n- **Constructor Injection Optimization** (Optional Step 7): Automatically migrates components to use constructor injection for immutable dependencies\n  - Moves `@Activate(Config config)` to constructor injection\n  - Migrates mandatory static unary `@Reference` fields to constructor parameters\n  - Makes fields `final` for immutability and thread safety\n  - Preserves optional\u002Fdynamic\u002Fmultiple references as field injection\n- **Enforced Versions**: Uses latest stable versions (component annotations 1.5.1, metatype 1.4.1)\n- **Validation**: Built-in validation checks for migration completeness\n- **Comprehensive Reporting**: Detailed statistics and warnings for all migrations\n- **Version Control Friendly**: No backup files created - use git or other SCM for change tracking\n\n## When to Use\n\n- Migrating legacy OSGi bundles using Felix SCR annotations\n- Upgrading to OSGi R6\u002FR7 standards\n- Modernizing AEM\u002FSling projects\n- Preparing projects for newer OSGi runtime versions\n- Removing maven-scr-plugin dependency\n\n## Prerequisites\n\nBefore using this migration skill, ensure you have:\n\n- **Python 3.7+** - Required to run the migration scripts\n- **Java 17+** - Required for compiling the migrated code (OSGi R6\u002FR7 annotations require Java 17+)\n- **Maven or Gradle** - For building and testing the project\n- **Version Control** - Git or similar (required for rollback capability)\n\n**Note**: The migrated code will use OSGi R6\u002FR7 Component annotations which require Java 17 or higher. Projects on older Java versions must upgrade to Java 17+ as part of this migration.\n\n## Migration Workflow\n\n### Step 1: Assessment and Preparation\n\n**IMPORTANT**: Before migration, commit all your code to git or another version control system. The migration scripts modify files directly without creating backups.\n\n```bash\n# Ensure code is committed\ngit status\ngit add .\ngit commit -m \"Pre-OSGi migration snapshot\"\n\n# Find files with SCR annotations\ngrep -r \"org.apache.felix.scr.annotations\" --include=\"*.java\" .\n\n# Check POM dependencies\ngrep -r \"felix.scr.annotations\" --include=\"pom.xml\" .\n\n# Count components to migrate\ngrep -r \"@Component\" --include=\"*.java\" . | wc -l\n```\n\nCreate a backup or ensure code is in version control before proceeding.\n\n### Step 2: Run Automated Migration\n\nUse the enhanced migration scripts for fully automated transformation:\n\n#### 2a. Migrate Java Annotations (Enhanced)\n\n```bash\n# Dry run to preview changes\npython3 scripts\u002Fmigrate_annotations.py \u002Fpath\u002Fto\u002Fsrc --dry-run\n\n# Apply changes with validation\npython3 scripts\u002Fmigrate_annotations.py \u002Fpath\u002Fto\u002Fsrc --validate\n\n# Tip: Commit to git before running to easily review\u002Frevert changes\ngit add . && git commit -m \"Pre-migration snapshot\"\n```\n\nThe enhanced script handles:\n- Import statement updates\n- `@Component` attribute transformation with property merging\n- `@Service` merging into `@Component`\n- `@Reference` cardinality updates (OPTIONAL_UNARY → OPTIONAL, etc.)\n- **Full `@Property` migration** with type specifications\n- **Automatic metatype configuration generation** for configurable components\n- **Complete `@SlingServlet` transformation** to @Component with servlet properties\n- **Complete `@SlingFilter` transformation** to @Component with filter properties\n- Lifecycle annotation imports (`@Activate`, `@Deactivate`, `@Modified`)\n- Validation and comprehensive reporting\n\n#### 2b. Migrate POM Files (Enhanced)\n\n```bash\n# Dry run to preview changes\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --dry-run\n\n# Apply changes with automatic metatype detection\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --auto-detect-metatype\n\n# Apply with validation\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --validate\n```\n\nThe enhanced script handles:\n- Removing `maven-scr-plugin` from all locations\n- Removing `org.apache.felix.scr.annotations` dependency\n- Adding `org.osgi.service.component.annotations` dependency (version **1.5.1** enforced) **at the beginning of the dependency list**\n- **Smart version detection** from existing OSGi dependencies\n- **Automatic metatype dependency addition** when detected (version **1.4.1** enforced) **placed after component annotations**\n- Ensuring OSGi bundle plugin (`maven-bundle-plugin` or `bnd-maven-plugin`) uses `extensions=true`\n- Removing obsolete SCR-specific plugin instructions\n- Pretty-printing XML with proper indentation\n- Validation and detailed reporting\n\n### Step 3: Review Migration Results\n\nThe scripts now provide comprehensive statistics:\n\n```\n======================================================================\nMIGRATION SUMMARY\n======================================================================\nFiles processed:              15\nFiles changed:                12\n@Component annotations:       45\n@Service merged:              38\n@Reference updated:           27\n@Property migrated:           156\n@SlingServlet migrated:       8\n@SlingFilter migrated:        3\nMetatype configs generated:   12\nImport statements updated:    180\n\nWarnings: 2\n  ⚠ MyService.java: Consider reviewing generated metatype configuration\n  ⚠ OtherService.java: Manual review recommended for complex property\n\nErrors: 0\n======================================================================\n```\n\n### Step 4: Advanced Features\n\n#### Metatype Configuration with Component Property Types (Fully Automated)\n\nFor components with `metatype = true`, the script automatically generates complete metatype configurations using **Component Property Types** (OSGi R7's preferred approach):\n\n- **@Component label\u002Fdescription** → **@ObjectClassDefinition name\u002Fdescription**\n- **@Property label\u002Fdescription** → **@AttributeDefinition name\u002Fdescription**\n- **@Activate(Map\u003CString, Object>)** → **@Activate(Config)** for type-safe access\n\n```java\n\u002F\u002F Before - Using deprecated Map approach\n@Component(metatype = true, label = \"My Service\", description = \"This is my service\")\n@Property(name = \"timeout\", intValue = 30, label = \"Timeout\", description = \"Request timeout in seconds\")\npublic class MyService {\n    @Activate\n    private void activate(Map\u003CString, Object> props) {\n        int timeout = PropertiesUtil.toInteger(props.get(\"timeout\"), 30);\n    }\n}\n\n\u002F\u002F After - Using Component Property Types (automatically generated)\n@Component\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\", description = \"This is my service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\", description = \"Request timeout in seconds\")\n        int timeout() default 30;\n    }\n\n    @Activate\n    private void activate(Config config) {\n        \u002F\u002F Type-safe, no conversion needed!\n        int timeout = config.timeout();\n    }\n}\n```\n\n**Why Component Property Types?**\n- ✅ **Type-safe**: No runtime type conversion errors\n- ✅ **Cleaner**: No PropertiesUtil or manual conversions\n- ✅ **IDE-friendly**: Auto-completion for configuration properties\n- ✅ **Maintainable**: Changes to config structure caught at compile-time\n- ✅ **OSGi R7 standard**: Modern best practice\n\n**Note:** The migration automatically:\n1. Captures all label\u002Fdescription metadata from @Component and @Property\n2. Generates the Config annotation interface\n3. Updates @Activate\u002F@Modified methods to use the Config type instead of Map\n\nThe POM is automatically updated with the OSGi annotations and metatype dependencies using the latest versions:\n```xml\n\u003Cdependency>\n    \u003CgroupId>org.osgi\u003C\u002FgroupId>\n    \u003CartifactId>org.osgi.service.component.annotations\u003C\u002FartifactId>\n    \u003Cversion>1.5.1\u003C\u002Fversion>\n    \u003Cscope>provided\u003C\u002Fscope>\n\u003C\u002Fdependency>\n\u003Cdependency>\n    \u003CgroupId>org.osgi\u003C\u002FgroupId>\n    \u003CartifactId>org.osgi.service.component\u003C\u002FartifactId>\n    \u003Cversion>1.5.1\u003C\u002Fversion>\n    \u003Cscope>provided\u003C\u002Fscope>\n\u003C\u002Fdependency>\n\u003Cdependency>\n    \u003CgroupId>org.osgi\u003C\u002FgroupId>\n    \u003CartifactId>org.osgi.service.metatype.annotations\u003C\u002FartifactId>\n    \u003Cversion>1.4.1\u003C\u002Fversion>\n    \u003Cscope>provided\u003C\u002Fscope>\n\u003C\u002Fdependency>\n```\n\n**Important**: This migration skill enforces the latest stable versions:\n- **org.osgi.service.component.annotations: 1.5.1** (required - provides @Component, @Reference, etc.)\n- **org.osgi.service.component: 1.5.1** (required - provides property type annotations like @ServiceDescription, @ServiceRanking, @ServiceVendor)\n- **org.osgi.service.metatype.annotations: 1.4.1** (required when metatype is used)\n\n**Automatic for Sling Projects**: When Sling servlets\u002Ffilters are detected:\n- **org.apache.sling.servlets.annotations: 1.2.6** (automatically added, provides type-safe Sling annotations)\n\nThese versions are required for proper OSGi R6\u002FR7 compatibility.\n\n#### Sling Annotations (Fully Automated)\n\nSling servlets and filters are completely automated. The migration uses type-safe Sling Servlets Annotations:\n\n```java\n\u002F\u002F Before\n@SlingServlet(\n    paths = \"\u002Fbin\u002Fmyservlet\",\n    methods = {\"GET\", \"POST\"},\n    extensions = {\"html\", \"json\"}\n)\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n\n\u002F\u002F After (automatically generated)\nimport org.apache.sling.servlets.annotations.SlingServletPaths;\nimport org.osgi.service.component.annotations.Component;\nimport javax.servlet.Servlet;\n\n@Component(service = Servlet.class)\n@SlingServletPaths(value = \"\u002Fbin\u002Fmyservlet\")\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n```\n\n**Path-based servlets** use `@SlingServletPaths`:\n```java\n@Component(service = Servlet.class)\n@SlingServletPaths(value = {\"\u002Fbin\u002Fservlet1\", \"\u002Fbin\u002Fservlet2\"})\n```\n\n**Resource-type-based servlets** use `@SlingServletResourceTypes`:\n```java\n@Component(service = Servlet.class)\n@SlingServletResourceTypes(\n    resourceTypes = \"my\u002Fresource\u002Ftype\",\n    selectors = \"print\",\n    extensions = {\"html\", \"pdf\"},\n    methods = {\"GET\", \"POST\"}\n)\n```\n\n**Filters** use `@SlingServletFilter`:\n```java\n@Component(service = Filter.class)\n@SlingServletFilter(\n    scope = SlingServletFilterScope.REQUEST,\n    order = -700,\n    pattern = \"\u002Fcontent\u002F.*\"\n)\n```\n\nThe migration automatically:\n- Detects Sling servlet\u002Ffilter usage in your Java files\n- Adds the `org.apache.sling.servlets.annotations:1.2.6` dependency to your POM\n- Transforms annotations to use the type-safe Sling Servlets Annotations format\n- Updates all necessary imports\n\nSee [references\u002Fannotation-mappings.md](references\u002Fannotation-mappings.md) for detailed examples of all Sling annotation transformations.\n\n### Step 5: Build and Test\n\n```bash\n# Clean and build\nmvn clean install\n\n# Run tests\nmvn test\n\n# Verify bundle activation\n# The migration scripts include validation to catch common issues\n```\n\n### Step 6: Run Validation\n\n```bash\n# Validate Java migrations\npython3 scripts\u002Fmigrate_annotations.py \u002Fpath\u002Fto\u002Fsrc --validate\n\n# Validate POM migrations\npython3 scripts\u002Fmigrate_pom.py \u002Fpath\u002Fto\u002Fproject --validate\n\n# Run comprehensive test suite\nbash scripts\u002Ftests\u002Frun_tests.sh\n```\n\n**✅ Basic migration complete!** If all tests pass, proceed to Step 7 for optional constructor injection optimization.\n\n---\n\n## ✨ Optional Post-Migration Optimization\n\nOnce the basic migration (Steps 1-6) is complete and all tests pass, consider **Step 7** below to further modernize your code with constructor injection.\n\n---\n\n### Step 7: Optimize with Constructor Injection (Automated, Optional)\n\n**⚠️ IMPORTANT**: Run this step AFTER completing Steps 1-6 and ensuring all tests pass.\n\nAutomatically optimize your code with modern OSGi best practices using **constructor injection**. This step is optional but highly recommended for cleaner, more maintainable code.\n\n**NEW**: This step is now fully automated using the `migrate_constructor_injection.py` script!\n\n#### Quick Start - Run the Migration\n\n```bash\n# Preview changes (dry-run) - RECOMMENDED FIRST\npython3 scripts\u002Fmigrate_constructor_injection.py \u002Fpath\u002Fto\u002Fsrc --dry-run\n\n# Apply migration with validation\npython3 scripts\u002Fmigrate_constructor_injection.py \u002Fpath\u002Fto\u002Fsrc --validate\n\n# Single file migration\npython3 scripts\u002Fmigrate_constructor_injection.py \u002Fpath\u002Fto\u002FMyService.java\n\n# Tip: Always commit to git before running\ngit add . && git commit -m \"Pre-constructor-injection snapshot\"\n```\n\n#### Benefits of Constructor Injection\n\n- ✅ **Immutability**: Dependencies declared as `final` fields\n- ✅ **Explicit Dependencies**: All dependencies visible in constructor signature\n- ✅ **Thread Safety**: Immutable references eliminate race conditions\n- ✅ **Testability**: Easier to mock dependencies in unit tests\n- ✅ **Modern Best Practice**: Aligned with OSGi R7\u002FR8 recommendations\n\n#### 7a. Constructor Injection for Configurations\n\nInstead of using `@Activate` methods to receive configuration, inject it directly in the constructor:\n\n```java\n\u002F\u002F After basic migration (Step 2)\n@Component\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\")\n        int timeout() default 30;\n\n        @AttributeDefinition(name = \"Max Retries\")\n        int maxRetries() default 3;\n    }\n\n    private int timeout;\n    private int maxRetries;\n\n    @Activate\n    private void activate(Config config) {\n        this.timeout = config.timeout();\n        this.maxRetries = config.maxRetries();\n    }\n}\n\n\u002F\u002F After optimization (Step 7)\n@Component\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\")\n        int timeout() default 30;\n\n        @AttributeDefinition(name = \"Max Retries\")\n        int maxRetries() default 3;\n    }\n\n    private final int timeout;\n    private final int maxRetries;\n\n    @Activate\n    public MyService(Config config) {\n        this.timeout = config.timeout();\n        this.maxRetries = config.maxRetries();\n    }\n}\n```\n\n**Key changes:**\n- Constructor is now `public` (OSGi requirement for constructor injection)\n- Configuration fields are `final` (immutable)\n- No separate `@Activate` method needed\n- Configuration is available immediately upon construction\n\n#### 7b. Constructor Injection for Unary Static Mandatory References\n\nFor references that are:\n- **Mandatory** (not optional)\n- **Static** (not dynamic)\n- **Unary** (single reference, not multiple)\n\nUse constructor injection to make dependencies explicit and immutable:\n\n```java\n\u002F\u002F After basic migration (Step 2) - Field injection\n@Component(service = MyService.class)\npublic class MyService {\n\n    @Reference\n    private ResourceResolverFactory resolverFactory;\n\n    @Reference\n    private SlingRepository repository;\n\n    @Reference(cardinality = ReferenceCardinality.OPTIONAL)\n    private ConfigurationAdmin configAdmin;  \u002F\u002F Optional - keep as field\n\n    public void doSomething() {\n        \u002F\u002F Use resolverFactory and repository\n    }\n}\n\n\u002F\u002F After optimization (Step 7) - Constructor injection for mandatory references\n@Component(service = MyService.class)\npublic class MyService {\n\n    private final ResourceResolverFactory resolverFactory;\n    private final SlingRepository repository;\n\n    \u002F\u002F Optional reference stays as field injection\n    @Reference(cardinality = ReferenceCardinality.OPTIONAL)\n    private ConfigurationAdmin configAdmin;\n\n    @Activate\n    public MyService(\n        @Reference ResourceResolverFactory resolverFactory,\n        @Reference SlingRepository repository\n    ) {\n        this.resolverFactory = resolverFactory;\n        this.repository = repository;\n    }\n\n    public void doSomething() {\n        \u002F\u002F Use resolverFactory and repository (guaranteed non-null)\n    }\n}\n```\n\n**When to use constructor injection for references:**\n- ✅ Mandatory references (`cardinality = MANDATORY` or no cardinality specified)\n- ✅ Static references (`policy = STATIC` or no policy specified)\n- ✅ Unary references (single service, not collections)\n\n**When to keep field injection:**\n- ❌ Optional references (`cardinality = OPTIONAL`)\n- ❌ Dynamic references (`policy = DYNAMIC`)\n- ❌ Multiple references (`cardinality = MULTIPLE` or `AT_LEAST_ONE`)\n- ❌ References with custom bind\u002Funbind methods\n\n#### 7c. Combined Configuration and References\n\nYou can combine configuration and reference injection in a single constructor:\n\n```java\n\u002F\u002F Optimized: Constructor injection for config + mandatory static references\n@Component(service = MyService.class)\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\")\n        int timeout() default 30;\n    }\n\n    private final int timeout;\n    private final ResourceResolverFactory resolverFactory;\n    private final SlingRepository repository;\n\n    \u002F\u002F Optional\u002Fdynamic references stay as field injection\n    @Reference(cardinality = ReferenceCardinality.OPTIONAL)\n    private ConfigurationAdmin configAdmin;\n\n    @Activate\n    public MyService(\n        Config config,\n        @Reference ResourceResolverFactory resolverFactory,\n        @Reference SlingRepository repository\n    ) {\n        this.timeout = config.timeout();\n        this.resolverFactory = resolverFactory;\n        this.repository = repository;\n    }\n}\n```\n\n**Important notes:**\n- Configuration parameter (if present) must be **first** in constructor\n- Reference parameters follow after configuration\n- Constructor must be `public` for OSGi to inject dependencies\n- Use `@Reference` annotation on each reference parameter\n- Reference attributes (target, cardinality, etc.) can be specified on parameters\n\n#### 7d. What the Script Does Automatically\n\nThe script automatically:\n- ✅ Identifies components with `@Activate(Config config)` methods\n- ✅ Identifies mandatory static unary `@Reference` fields\n- ✅ Creates public constructor with `@Activate` annotation\n- ✅ Moves config parameter to constructor (first parameter)\n- ✅ Moves eligible references to constructor parameters\n- ✅ Makes fields `final` for immutability\n- ✅ Preserves optional\u002Fdynamic\u002Fmultiple references as field injection\n- ✅ Generates comprehensive migration statistics\n\n**What the script does NOT migrate** (kept as field injection):\n- ❌ Optional references (`cardinality = OPTIONAL`)\n- ❌ Dynamic references (`policy = DYNAMIC`)\n- ❌ Multiple references (`cardinality = MULTIPLE` or `AT_LEAST_ONE`)\n- ❌ References with custom bind\u002Funbind methods\n- ❌ Collection references (List, Set, Collection)\n\n#### 7e. Post-Migration Verification\n\nAfter running the automated migration, verify the changes:\n\n1. **Review the migration statistics**:\n   ```\n   ======================================================================\n   CONSTRUCTOR INJECTION MIGRATION SUMMARY\n   ======================================================================\n   Files processed:              15\n   Files changed:                8\n   Components migrated:          8\n   Configs converted:            6\n   References converted:         14\n   Fields made final:            20\n   ======================================================================\n   ```\n\n2. **Test thoroughly**:\n   ```bash\n   mvn clean install\n   mvn test\n   ```\n\n3. **Verify OSGi activation**:\n   - Check OSGi console for component activation\n   - Verify all references are satisfied\n   - Test component functionality\n\n4. **Review generated constructors**:\n   - Constructor is `public` ✓\n   - `@Activate` annotation on constructor ✓\n   - Config parameter is first (if present) ✓\n   - Only mandatory static unary references moved to constructor ✓\n   - Optional\u002Fdynamic references remain as fields ✓\n   - Fields are `final` where appropriate ✓\n\n**If tests fail**: Use `git diff` to review changes and `git checkout .` to revert if needed.\n\n## Advanced Usage\n\n### Command-Line Options\n\n#### Constructor Injection Migration Script (Step 7)\n\n```bash\npython3 scripts\u002Fmigrate_constructor_injection.py [OPTIONS] PATH\n\nOptions:\n  --dry-run          Preview changes without modifying files\n  --validate         Validate migrated code for common issues\n\nExamples:\n  # Preview all changes\n  python3 scripts\u002Fmigrate_constructor_injection.py src\u002F --dry-run\n\n  # Migrate with validation\n  python3 scripts\u002Fmigrate_constructor_injection.py src\u002F --validate\n\n  # Single file migration\n  python3 scripts\u002Fmigrate_constructor_injection.py src\u002Fmain\u002Fjava\u002FMyService.java\n\n  # Use git to review changes\n  git diff src\u002F\n```\n\n#### Java Migration Script (Step 2)\n\n```bash\npython3 scripts\u002Fmigrate_annotations.py [OPTIONS] PATH\n\nOptions:\n  --dry-run          Preview changes without modifying files\n  --validate         Validate migrated code for common issues\n\nExamples:\n  # Preview all changes\n  python3 scripts\u002Fmigrate_annotations.py src\u002F --dry-run\n\n  # Migrate with validation\n  python3 scripts\u002Fmigrate_annotations.py src\u002F --validate\n\n  # Use git to review changes\n  git diff src\u002F\n```\n\n#### POM Migration Script\n\n```bash\npython3 scripts\u002Fmigrate_pom.py [OPTIONS] PATH\n\nOptions:\n  --dry-run              Preview changes without modifying files\n  --validate             Validate migrated POMs\n  --add-metatype         Add metatype dependency\n  --auto-detect-metatype Auto-detect metatype usage from Java files\n  --detect-versions      Detect OSGi versions from existing deps (default: True)\n\nExamples:\n  # Migrate with automatic metatype detection\n  python3 scripts\u002Fmigrate_pom.py . --auto-detect-metatype\n\n  # Dry run with validation\n  python3 scripts\u002Fmigrate_pom.py . --dry-run --validate\n\n  # Use git to review changes\n  git diff pom.xml\n```\n\n### Testing\n\nThe skill includes comprehensive unit tests:\n\n```bash\n# Run all tests\nbash scripts\u002Ftests\u002Frun_tests.sh\n\n# Run Java migration tests\npython3 scripts\u002Ftests\u002Ftest_migrate_annotations.py\n\n# Run POM migration tests\npython3 scripts\u002Ftests\u002Ftest_migrate_pom.py\n\n# Run constructor injection migration tests\npython3 scripts\u002Ftests\u002Ftest_migrate_constructor_injection.py\n```\n\nTest coverage includes:\n- Property parsing and conversion\n- Metatype configuration generation\n- Sling annotation transformation\n- Reference cardinality migration\n- Complete file migration scenarios\n- POM plugin and dependency updates\n- Version detection\n- Statistics tracking\n- **Constructor injection migration** (config and reference conversion)\n- **Reference eligibility detection** (mandatory\u002Foptional, static\u002Fdynamic)\n- **Field final modifier addition**\n\n## Migration Patterns\n\n### Pattern 1: Basic Component with Properties\n\n```java\n\u002F\u002F Before\n@Component(immediate = true)\n@Service\n@Property(name = \"service.vendor\", value = \"Apache Software Foundation\")\n@Property(name = \"service.ranking\", intValue = 100)\npublic class MyService implements SomeInterface {\n}\n\n\u002F\u002F After (fully automated)\n@Component(\n    immediate = true,\n    service = SomeInterface.class,\n    property = {\n        \"service.vendor=Apache Software Foundation\",\n        \"service.ranking:Integer=100\"\n    }\n)\npublic class MyService implements SomeInterface {\n}\n```\n\n### Pattern 2: Configurable Component with Component Property Types\n\n```java\n\u002F\u002F Before - Using deprecated Map approach\n@Component(metatype = true, immediate = true, label = \"My Service\", description = \"Service description\")\n@Property(name = \"timeout\", intValue = 30, label = \"Timeout\", description = \"Request timeout\")\n@Property(name = \"retries\", intValue = 3, label = \"Retries\", description = \"Number of retries\")\npublic class MyService {\n    @Activate\n    private void activate(Map\u003CString, Object> props) {\n        int timeout = PropertiesUtil.toInteger(props.get(\"timeout\"), 30);\n        int retries = PropertiesUtil.toInteger(props.get(\"retries\"), 3);\n    }\n}\n\n\u002F\u002F After - Using Component Property Types (fully automated, type-safe)\n@Component(immediate = true)\n@Designate(ocd = MyService.Config.class)\npublic class MyService {\n\n    @ObjectClassDefinition(name = \"My Service\", description = \"Service description\")\n    public @interface Config {\n        @AttributeDefinition(name = \"Timeout\", description = \"Request timeout\")\n        int timeout() default 30;\n\n        @AttributeDefinition(name = \"Retries\", description = \"Number of retries\")\n        int retries() default 3;\n    }\n\n    @Activate\n    private void activate(Config config) {\n        \u002F\u002F Type-safe access - no conversion utilities needed!\n        int timeout = config.timeout();\n        int retries = config.retries();\n    }\n}\n```\n\n**Note**: Component Property Types are the OSGi R7 best practice and are automatically generated by the migration.\n\n### Pattern 3: Sling Servlet\n\n```java\n\u002F\u002F Before\n@SlingServlet(\n    resourceTypes = \"my\u002Fresource\u002Ftype\",\n    selectors = {\"print\", \"pdf\"},\n    extensions = \"html\"\n)\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n\n\u002F\u002F After (fully automated using Sling Servlets Annotations)\nimport org.apache.sling.servlets.annotations.SlingServletResourceTypes;\nimport org.osgi.service.component.annotations.Component;\nimport javax.servlet.Servlet;\n\n@Component(service = Servlet.class)\n@SlingServletResourceTypes(\n    resourceTypes = \"my\u002Fresource\u002Ftype\",\n    selectors = {\"print\", \"pdf\"},\n    extensions = \"html\"\n)\npublic class MyServlet extends SlingAllMethodsServlet {\n}\n```\n\n## Reference Documentation\n\nFor comprehensive annotation mappings and examples:\n\n```bash\n# View complete mapping reference\ncat references\u002Fannotation-mappings.md\n```\n\nThis includes:\n- All annotation transformations with before\u002Fafter examples\n- Cardinality and policy mappings\n- Property type specifications\n- Sling annotation patterns\n- Common migration patterns\n\n## Troubleshooting\n\n### Components Not Activating\n\nCheck:\n- `service` attribute properly set in `@Component`\n- All required dependencies satisfied\n- No compilation errors\n- Run validation: `python3 scripts\u002Fmigrate_annotations.py src\u002F --validate`\n\n### Configuration Not Working\n\n- Verify metatype annotations are present\n- Check `@Designate` links to correct config interface\n- Ensure activate method signature matches config type\n- POM contains metatype dependency (auto-added with `--auto-detect-metatype`)\n\n### Build Failures\n\n- Ensure OSGi bundle plugin (`maven-bundle-plugin` or `bnd-maven-plugin`) has `extensions=true` (auto-fixed)\n- Verify all OSGi annotation dependencies are present (auto-added)\n- Run POM validation: `python3 scripts\u002Fmigrate_pom.py . --validate`\n- Check migration summary for errors and warnings\n\n### Migration Issues\n\nIf you encounter any issues:\n\n1. **Review the statistics**: The summary shows exactly what was changed\n2. **Check warnings**: The script flags items that may need review\n3. **Use dry-run**: Preview changes before applying them\n4. **Run tests**: Use the included test suite to verify migration logic\n5. **Validate**: Use `--validate` flag to check for common issues\n\n## Performance\n\nThe enhanced migration scripts are optimized for large codebases:\n\n- Processes hundreds of files per second\n- Memory-efficient line-by-line processing\n- Parallel processing support (via multiple script invocations)\n- Progress reporting for large projects\n\nExample performance:\n- 500 Java files: ~30 seconds\n- 1000 Java files: ~1 minute\n- 50 POM files: ~5 seconds\n\n## What's New in Enhanced Version\n\n### Version 2.1 Features (Latest)\n\n- ✅ **Constructor Injection Automation**: NEW! Automated Step 7 optimization for modern OSGi best practices\n- ✅ **Immutable Dependencies**: Automatically makes fields `final` when migrated to constructor\n- ✅ **Smart Reference Detection**: Identifies eligible vs ineligible references for constructor injection\n- ✅ **Config Parameter Migration**: Moves `@Activate(Config config)` to constructor injection\n\n### Version 2.0 Features\n\n- ✅ **Full Property Migration**: Complete automation of @Property transformations\n- ✅ **Metatype Generation**: Automatic configuration interface creation\n- ✅ **Sling Automation**: Complete @SlingServlet and @SlingFilter migration\n- ✅ **Smart Version Detection**: Automatic OSGi version inference\n- ✅ **Comprehensive Validation**: Built-in checks for migration quality\n- ✅ **Detailed Reporting**: Statistics and warnings for all operations\n- ✅ **Test Suite**: Comprehensive unit and integration tests\n- ✅ **Error Recovery**: Graceful handling of edge cases\n\n### Improvements Over Original\n\n| Feature | Original | Enhanced | v2.1 |\n|---------|----------|----------|------|\n| @Property Migration | TODO comments | Fully automated | ✓ |\n| Metatype Support | Manual | Auto-generated | ✓ |\n| Sling Annotations | TODO comments | Fully automated | ✓ |\n| Constructor Injection | Not available | Manual guidance | **Fully automated** |\n| Validation | None | Comprehensive | ✓ |\n| Reporting | Basic | Detailed stats | ✓ |\n| Testing | None | Full test suite | Enhanced |\n| Version Detection | Hardcoded | Smart detection | ✓ |\n| Error Handling | Basic | Robust | ✓ |\n\n## Additional Resources\n\n- OSGi Compendium Specification: Component annotations (Chapter 112)\n- Apache Felix SCR documentation\n- Sling development documentation for servlet\u002Ffilter annotations\n- Apache Sling Servlets Annotations: https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-org-apache-sling-servlets-annotations\n- Test suite: `scripts\u002Ftests\u002F`\n- Example transformations: `references\u002Fannotation-mappings.md`\n\n## Sling-Specific Features\n\nFor **Apache Sling projects**, the migration provides full automation:\n\n1. **Automatic Detection**: The migration automatically detects Sling servlet and filter usage by scanning your Java files for:\n   - `@SlingServlet` annotations\n   - `@SlingFilter` annotations\n   - Existing `@SlingServletPaths`, `@SlingServletResourceTypes`, or `@SlingServletFilter` annotations\n\n2. **Dependency Management**: When Sling usage is detected, the migration automatically:\n   - Adds the `org.apache.sling.servlets.annotations:1.2.6` dependency to your POM\n   - Places it after OSGi component and metatype dependencies\n   - Sets the correct scope (`provided`)\n\n3. **Type-Safe Transformations**: The migration uses type-safe Sling Servlets Annotations:\n   - `@SlingServletPaths` for path-based servlets\n   - `@SlingServletResourceTypes` for resource-type-based servlets with selectors, extensions, and methods\n   - `@SlingServletFilter` for filters with scope, order, and pattern\n\n   This provides better IDE support, compile-time validation, and improved readability compared to property strings.\n\nSee [Sling annotation examples](references\u002Fannotation-mappings.md#sling-annotations) for detailed transformation syntax.\n\n## Notes\n\n- The migration scripts now handle **98%+ of migrations automatically** (including Step 7 constructor injection!)\n- Manual review is only needed for very complex edge cases\n- Always test in a development environment before production deployment\n- **Java 17+ is required** for OSGi R6\u002FR7 Component annotations (this is a prerequisite, not optional)\n- Run the test suite to verify migration logic: `bash scripts\u002Ftests\u002Frun_tests.sh`\n- Some runtime behavior may differ subtly between SCR and R6+ implementations\n- **Step 7 is optional** but recommended - the automated script makes it easy and safe to apply\n",{"name":5,"description":7},"master","d568740afee83b99732b9e474aa3a125b5fa91f8","skills\u002Fosgi-scr-migrator",1,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills","https:\u002F\u002Fsling.apache.org\u002F","https:\u002F\u002Fgithub.com\u002Fapache","https:\u002F\u002Fwww.apache.org\u002F","2026-10-30 19:47:07",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add apache\u002Fsling-agent-skills --skill osgi-scr-migrator",{"tool":52,"command":53},"bunx","bunx skills add apache\u002Fsling-agent-skills --skill osgi-scr-migrator",{"tool":55,"command":56},"pnpm","pnpm dlx skills add apache\u002Fsling-agent-skills --skill osgi-scr-migrator","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002FSKILL.md",true,[60,65,71,75,79,83,87,91,95,101,105,109,113,117,121,125,129,133,137],{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":14,"sourceHtmlUrl":64},".codex","OTHER","其他","https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002F.codex",{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"ci.md","REFERENCE","参考文档",1304,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Fci.md",{"path":72,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":73,"sourceHtmlUrl":74},"dev-tools.md",164,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Fdev-tools.md",{"path":76,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":77,"sourceHtmlUrl":78},"hono.md",5543,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Fhono.md",{"path":80,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":81,"sourceHtmlUrl":82},"oxc.md",19135,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Foxc.md",{"path":84,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":85,"sourceHtmlUrl":86},"package.md",2399,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Fpackage.md",{"path":88,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":89,"sourceHtmlUrl":90},"README.md",15037,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002FREADME.md",{"path":92,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":93,"sourceHtmlUrl":94},"references\u002Fannotation-mappings.md",25301,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Freferences\u002Fannotation-mappings.md",{"path":96,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":99,"sourceHtmlUrl":100},"scripts\u002Fmigrate_annotations.py","SCRIPT","脚本",58834,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Fscripts\u002Fmigrate_annotations.py",{"path":102,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":103,"sourceHtmlUrl":104},"scripts\u002Fmigrate_constructor_injection.py",27733,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Fscripts\u002Fmigrate_constructor_injection.py",{"path":106,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":107,"sourceHtmlUrl":108},"scripts\u002Fmigrate_pom.py",28268,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Fscripts\u002Fmigrate_pom.py",{"path":110,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":111,"sourceHtmlUrl":112},"scripts\u002Ftests\u002Frun_tests.sh",1311,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Fscripts\u002Ftests\u002Frun_tests.sh",{"path":114,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":115,"sourceHtmlUrl":116},"scripts\u002Ftests\u002Ftest_migrate_annotations.py",51003,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Fscripts\u002Ftests\u002Ftest_migrate_annotations.py",{"path":118,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":119,"sourceHtmlUrl":120},"scripts\u002Ftests\u002Ftest_migrate_constructor_injection.py",19070,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Fscripts\u002Ftests\u002Ftest_migrate_constructor_injection.py",{"path":122,"resourceType":97,"resourceTypeDesc":98,"sizeBytes":123,"sourceHtmlUrl":124},"scripts\u002Ftests\u002Ftest_migrate_pom.py",16517,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fosgi-scr-migrator\u002Fscripts\u002Ftests\u002Ftest_migrate_pom.py",{"path":126,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":127,"sourceHtmlUrl":128},"shadcn-ui.md",875,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Fshadcn-ui.md",{"path":130,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":131,"sourceHtmlUrl":132},"tanstack-spa.md",3308,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Ftanstack-spa.md",{"path":134,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":135,"sourceHtmlUrl":136},"typescript.md",1855,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Ftypescript.md",{"path":138,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":139,"sourceHtmlUrl":140},"workspace.md",574,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fd-kimuson-dotfiles\u002Fclaude-code\u002Fskills\u002Fts-project-initialize\u002Fworkspace.md",[142,151],{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":148,"publishedAt":32},"01M6AD1WCGGQDP42RSBC13QTX2","update-sling-parent-pom","Use when the user asks to upgrade the Sling parent POM version in their project","https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fupdate-sling-parent-pom\u002FSKILL.md",[],[149,150],"update","update sling parent pom",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":32},"01M6AD1TAXS9F6BZ34Y9M8A6H5","sling-release","Automates releasing an Apache Sling project end-to-end using Maven and the sling-cli Docker tool. Use when the user wants to release a Sling project, start a release, perform any step of the Apache Sling release process, or asks about releasing\u002Fvoting\u002Fpromoting a Sling module.","https:\u002F\u002Fgithub.com\u002Fapache\u002Fsling-agent-skills\u002Fblob\u002Fmaster\u002Fskills\u002Fsling-release\u002FSKILL.md",[],[158,159,160,161,162,9],"release","sling release","cli","docker","release process"]