-
Notifications
You must be signed in to change notification settings - Fork 17
feat(dev-team): add licensing skill and command #329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| --- | ||
| name: ring:dev-license | ||
| description: Apply or switch the license for the current repository | ||
| argument-hint: "[apache|elv2|proprietary] [options]" | ||
| --- | ||
|
|
||
| Apply or switch the license for the current repository. | ||
|
|
||
| ## Usage | ||
|
|
||
| ``` | ||
| /ring:dev-license [license-type] [options] | ||
| ``` | ||
|
|
||
| ## Arguments | ||
|
|
||
| | Argument | Required | Description | | ||
| |----------|----------|-------------| | ||
| | `license-type` | No* | One of: `apache`, `elv2`, `proprietary` | | ||
|
|
||
| *If omitted, the skill will detect the current license and ask which to apply. | ||
|
|
||
| ## Options | ||
|
|
||
| | Option | Description | Example | | ||
| |--------|-------------|---------| | ||
| | `--dry-run` | Show what would change without modifying files | `--dry-run` | | ||
| | `--year YEAR` | Override copyright year (default: current year) | `--year 2025` | | ||
| | `--holder NAME` | Override copyright holder (default: Lerian Studio Ltd.) | `--holder "Lerian Studio Ltd."` | | ||
|
|
||
| ## License Types | ||
|
|
||
| | Type | Full Name | SPDX | Use Case | | ||
| |------|-----------|------|----------| | ||
| | `apache` | Apache License 2.0 | `Apache-2.0` | Open source (e.g., Midaz core) | | ||
| | `elv2` | Elastic License v2 | `Elastic-2.0` | Source-available Lerian products | | ||
| | `proprietary` | Lerian Studio General License | `LicenseRef-Lerian-Proprietary` | Internal/closed repos | | ||
|
|
||
| ## Examples | ||
|
|
||
| ```bash | ||
| # Apply Apache 2.0 license | ||
| /ring:dev-license apache | ||
|
|
||
| # Switch to ELv2 | ||
| /ring:dev-license elv2 | ||
|
|
||
| # Apply proprietary license with specific year | ||
| /ring:dev-license proprietary --year 2024 | ||
|
|
||
| # Check what would change without modifying | ||
| /ring:dev-license apache --dry-run | ||
|
|
||
| # Detect current license (interactive) | ||
| /ring:dev-license | ||
| ``` | ||
|
|
||
| ## What It Does | ||
|
|
||
| 1. **Detects** current license (LICENSE file, source headers, SPDX identifiers) | ||
| 2. **Confirms** change with user (if switching from an existing license) | ||
| 3. **Writes** the LICENSE file with the full license text | ||
| 4. **Updates** all source file headers (.go, .ts, .js) to match | ||
| 5. **Updates** SPDX identifiers in go.mod/package.json (if present) | ||
| 6. **Updates** README.md license badge/section (if present) | ||
| 7. **Validates** all files have consistent headers | ||
|
|
||
| ## Related Commands | ||
|
|
||
| | Command | Description | | ||
| |---------|-------------| | ||
| | `/ring:dev-cycle` | Development cycle (includes license check at Gate 0) | | ||
| | `/ring:dev-refactor` | Codebase analysis (may detect license inconsistencies) | | ||
|
|
||
| --- | ||
|
|
||
| ## MANDATORY: Load Full Skill | ||
|
|
||
| **This command MUST load the skill for complete workflow execution.** | ||
|
|
||
| ``` | ||
| Use Skill tool: ring:dev-licensing | ||
| ``` | ||
|
|
||
| The skill contains the complete 4-gate workflow with: | ||
| - License detection and identification | ||
| - User confirmation gate | ||
| - Agent dispatch for header updates | ||
| - Validation with consistency checks | ||
| - Anti-rationalization tables | ||
| - Pressure resistance scenarios | ||
|
|
||
| ## Execution Context | ||
|
|
||
| Pass the following context to the skill: | ||
|
|
||
| | Parameter | Value | | ||
| |-----------|-------| | ||
| | `license_type` | First argument: `apache`, `elv2`, or `proprietary` (if provided) | | ||
| | `dry_run` | `true` if `--dry-run` flag present | | ||
| | `copyright_year` | Value of `--year` option (default: current year) | | ||
| | `copyright_holder` | Value of `--holder` option (default: `Lerian Studio Ltd.`) | |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1834,6 +1834,28 @@ PM team task files often omit external_dependencies. If the codebase uses postgr | |
| Multi-tenant state is detected here and passed to Gate 0 (implementation) and Gate 0.5G (verification). See [multi-tenant.md](../../docs/standards/golang/multi-tenant.md) for the canonical model and compliance criteria. | ||
| </auto_detect_reason> | ||
|
|
||
| ### License Detection (Advisory) | ||
|
|
||
| Detect the repository license at cycle start. This check is advisory — it does not block Gate 0. If no license is found, prompt the user; if the user declines, log a warning and proceed. | ||
|
|
||
| ```text | ||
| 7. Detect repository license: | ||
| license_type = "unknown" | ||
|
|
||
| - ls LICENSE LICENSE.md LICENSE.txt 2>/dev/null | ||
| - If found: | ||
| - grep -l "Apache License" LICENSE* → license_type = "apache" | ||
| - grep -l "Elastic License" LICENSE* → license_type = "elv2" | ||
| - grep -l "All rights reserved.*Lerian" LICENSE* → license_type = "proprietary" | ||
| - If not found (no LICENSE file): | ||
| → Ask user: "No LICENSE file detected. Which license should this repository use? [apache|elv2|proprietary|skip]" | ||
| → If user selects a license: invoke Skill("ring:dev-licensing") with chosen type | ||
| → If user selects "skip": log "⚠️ WARNING: No LICENSE file. License headers may be inconsistent." | ||
|
|
||
| Store: state.license_type = license_type | ||
| Log: "License detected: {license_type}" | ||
|
Comment on lines
+1851
to
+1856
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Persist the selected license value before writing state After the prompt flow (Line 1851-Line 1853), 🔧 Proposed fix-7. Detect repository license:
- license_type = "unknown"
+7. Detect repository license:
+ license_type = "unknown"
+ selected_license = ""
@@
- - If not found (no LICENSE file):
+ - If not found (no LICENSE file):
→ Ask user: "No LICENSE file detected. Which license should this repository use? [apache|elv2|proprietary|skip]"
- → If user selects a license: invoke Skill("ring:dev-licensing") with chosen type
+ → If user selects a license:
+ - selected_license = {user_selection}
+ - license_type = selected_license
+ - invoke Skill("ring:dev-licensing") with chosen type
→ If user selects "skip": log "⚠️ WARNING: No LICENSE file. License headers may be inconsistent."🤖 Prompt for AI Agents |
||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Step 2: Gate 0 - Implementation (Per Execution Unit) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Header component guidance conflicts with ELv2 required template
Line 904-Line 905 says no LICENSE-file reference is needed, but the ELv2 required header template (Line 879-Line 883) explicitly requires
LICENSEreference. This contradiction can produce non-compliant headers.🔧 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents