Skip to content

Commit 2be8039

Browse files
authored
Merge pull request #16 from karolswdev/cleanup-deprecate-legacy-format
Remove legacy STORY tooling and refresh docs
2 parents b0c9924 + 33aa9ec commit 2be8039

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+198
-1651
lines changed

CHANGELOG.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,20 @@ Matches or exceeds industry standards of kubectl, terraform, and gh CLI:
136136
- Conflict detection and resolution workflow
137137
- TestPullService_ConflictResolvedWithForce test
138138
- **Milestone 1**: Canonical markdown schema and tooling
139-
- Parser rejection of legacy # STORY: format
140-
- ticketr migrate command with dry-run and --write modes
141-
- 11 new tests (3 parser + 7 migration + 1 service)
142-
- docs/migration-guide.md (175 lines)
139+
- Parser rejection of `# STORY:` heading with actionable error
140+
- Manual update guidance documented in README/WORKFLOW
141+
- 4 new tests (parser rejection cases + service guardrail)
143142
- examples/README.md (155 lines)
144143
- **Milestone 0**: Repository recon and standards alignment
145144
- Canonical # TICKET: format established
146-
- Legacy # STORY: format deprecated with clear errors
147-
- testdata/legacy_story/ fixtures for regression tests
145+
- `# STORY:` heading rejected with clear errors
146+
- testdata/unsupported_story/ fixtures for regression tests
148147
- docs/README.md documenting test strategy
149148

150149
### Changed
151150
- Renamed from jira-story-creator to ticketr
152151
- All examples migrated to canonical # TICKET: format
153-
- Enhanced README with migration guidance
152+
- Enhanced README with schema guidance
154153

155154
### Fixed
156155
- Spurious change detection from non-deterministic map iteration

CONTRIBUTING.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ internal/
5151
│ ├── jira/ # JIRA API integration
5252
│ └── filesystem/ # Markdown file I/O
5353
├── parser/ # Markdown parser
54+
├── renderer/ # Markdown rendering utilities
5455
├── state/ # State management (.ticketr.state)
55-
├── logging/ # File logging
56-
└── migration/ # Legacy format migration
56+
└── logging/ # File logging
5757
```
5858

5959
**Key principles:**
@@ -182,15 +182,14 @@ bash tests/smoke/smoke_test.sh
182182
```
183183

184184
**Scenarios tested:**
185-
1. Legacy file migration
186-
2. Push dry-run validation
187-
3. Pull with missing file
188-
4. State file creation and persistence
189-
5. Log file creation
190-
6. Help command functionality
191-
7. Concurrent file operations safety
185+
1. Push dry-run validation
186+
2. Pull with missing file
187+
3. State file creation and persistence
188+
4. Log file creation
189+
5. Help command functionality
190+
6. Concurrent file operations safety
192191

193-
**Expected:** 7/7 scenarios passing, 13/13 checks passing
192+
**Expected:** 6/6 scenarios passing, 12/12 checks passing
194193

195194
See [`tests/smoke/README.md`](tests/smoke/README.md) for detailed smoke test documentation.
196195

@@ -318,7 +317,7 @@ All documentation must follow the [Documentation Style Guide](docs/style-guide.m
318317
- Add TODO comments for future work
319318

320319
**Markdown Formatting:**
321-
- Use kebab-case file names (`migration-guide.md`)
320+
- Use kebab-case file names (e.g., `state-management.md`)
322321
- Always specify language hints in code blocks (```bash, ```go, etc.)
323322
- Use relative links for internal documentation
324323
- Follow heading hierarchy (single H1, proper H2/H3/H4 nesting)

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Manage JIRA tickets using Markdown files with bidirectional sync. Version contro
88
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
99
[![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?style=flat&logo=docker)](Dockerfile)
1010

11-
> **v2.0 Breaking Change:** Legacy `# STORY:` format deprecated. Use `ticketr migrate` to upgrade. See [Migration Guide](docs/migration-guide.md).
11+
> **Note:** Ticketr requires `# TICKET:` headings. Files using `# STORY:` must be updated before use.
1212
1313
## Features
1414

@@ -100,8 +100,6 @@ ticketr push tickets.md --force-partial-upload
100100
# Discover JIRA schema/fields
101101
ticketr schema > .ticketr.yaml
102102

103-
# Migrate legacy format
104-
ticketr migrate old-tickets.md --write
105103
```
106104

107105
## Key Concepts
@@ -218,7 +216,6 @@ See [examples/](examples/) directory for:
218216
- [WORKFLOW.md](docs/WORKFLOW.md) - End-to-end usage guide
219217
- [ARCHITECTURE.md](docs/ARCHITECTURE.md) - Technical architecture
220218
- [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md) - Common issues
221-
- [migration-guide.md](docs/migration-guide.md) - v1.x → v2.0 migration
222219
- [state-management.md](docs/state-management.md) - Change detection
223220
- [release-process.md](docs/release-process.md) - Release management
224221
- [CONTRIBUTING.md](CONTRIBUTING.md) - Contribution guide

SUPPORT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Before seeking support, please check our comprehensive documentation:
1010
- **[Quick Start Guide](https://github.com/karolswdev/ticktr/wiki/Quick-Start-Tutorial)** - Get started in 5 minutes
1111
- **[Documentation](docs/)** - Complete documentation suite
1212
- [WORKFLOW.md](docs/WORKFLOW.md) - End-to-end workflows and examples
13-
- [Migration Guide](docs/migration-guide.md) - Migrating from legacy format
1413
- [State Management](docs/state-management.md) - Understanding .ticketr.state
1514
- [Release Process](docs/release-process.md) - Version and release information
1615
- **[Examples](examples/)** - Ready-to-use templates and examples

cmd/ticketr/main.go

Lines changed: 1 addition & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import (
55
"fmt"
66
"log"
77
"os"
8-
"path/filepath"
98
"strings"
109

1110
"github.com/karolswdev/ticktr/internal/adapters/filesystem"
1211
"github.com/karolswdev/ticktr/internal/adapters/jira"
1312
"github.com/karolswdev/ticktr/internal/core/services"
1413
"github.com/karolswdev/ticktr/internal/core/validation"
1514
"github.com/karolswdev/ticktr/internal/logging"
16-
"github.com/karolswdev/ticktr/internal/migration"
1715
"github.com/karolswdev/ticktr/internal/state"
1816
"github.com/spf13/cobra"
1917
"github.com/spf13/viper"
@@ -32,9 +30,6 @@ var (
3230
pullOutput string
3331
pullForce bool
3432

35-
// Migrate command flags
36-
writeFlag bool
37-
3833
rootCmd = &cobra.Command{
3934
Use: "ticketr",
4035
Short: "A tool for managing JIRA tickets as code",
@@ -67,22 +62,6 @@ to overwrite local changes with remote changes when conflicts occur.`,
6762
Run: runSchema,
6863
}
6964

70-
migrateCmd = &cobra.Command{
71-
Use: "migrate [file]",
72-
Short: "Convert legacy # STORY: format to # TICKET:",
73-
Long: `Migrates Markdown files from deprecated # STORY: schema to canonical # TICKET: schema.
74-
75-
By default, runs in dry-run mode showing preview of changes.
76-
Use --write flag to apply changes to files.
77-
78-
Examples:
79-
ticketr migrate path/to/story.md # Preview changes
80-
ticketr migrate path/to/story.md --write # Apply changes
81-
ticketr migrate examples/*.md --write # Batch migration`,
82-
Args: cobra.MinimumNArgs(1),
83-
Run: runMigrate,
84-
}
85-
8665
// Legacy commands for backward compatibility
8766
legacyCmd = &cobra.Command{
8867
Use: "legacy",
@@ -108,14 +87,10 @@ func init() {
10887
pullCmd.Flags().StringVarP(&pullOutput, "output", "o", "pulled_tickets.md", "output file path")
10988
pullCmd.Flags().BoolVar(&pullForce, "force", false, "Force overwrite local changes with remote changes when conflicts are detected")
11089

111-
// Migrate command flags
112-
migrateCmd.Flags().BoolVarP(&writeFlag, "write", "w", false, "Write changes to files")
113-
11490
// Add commands to root
11591
rootCmd.AddCommand(pushCmd)
11692
rootCmd.AddCommand(pullCmd)
11793
rootCmd.AddCommand(schemaCmd)
118-
rootCmd.AddCommand(migrateCmd)
11994
rootCmd.AddCommand(legacyCmd)
12095

12196
// Legacy flags for backward compatibility
@@ -529,100 +504,6 @@ func processFieldForSchema(field map[string]interface{}, customFieldsMap map[str
529504
}
530505
}
531506

532-
// runMigrate handles the migrate command
533-
func runMigrate(cmd *cobra.Command, args []string) {
534-
// Create migrator with DryRun based on writeFlag
535-
migrator := &migration.Migrator{
536-
DryRun: !writeFlag,
537-
}
538-
539-
// Track overall success/failure
540-
hasErrors := false
541-
totalFiles := 0
542-
totalChanges := 0
543-
544-
// Process each file argument (supports glob patterns)
545-
for _, pattern := range args {
546-
// Expand glob pattern
547-
matches, err := filepath.Glob(pattern)
548-
if err != nil {
549-
fmt.Printf("Error processing pattern '%s': %v\n", pattern, err)
550-
hasErrors = true
551-
continue
552-
}
553-
554-
if len(matches) == 0 {
555-
// No glob match, treat as literal file path
556-
matches = []string{pattern}
557-
}
558-
559-
// Process each matched file
560-
for _, filePath := range matches {
561-
totalFiles++
562-
563-
// Get absolute path for display
564-
absPath, err := filepath.Abs(filePath)
565-
if err != nil {
566-
absPath = filePath
567-
}
568-
569-
// Perform migration
570-
content, changed, err := migrator.MigrateFile(filePath)
571-
if err != nil {
572-
fmt.Printf("Error migrating %s: %v\n", absPath, err)
573-
hasErrors = true
574-
continue
575-
}
576-
577-
if !changed {
578-
if verbose {
579-
fmt.Printf("No changes needed: %s\n", absPath)
580-
}
581-
continue
582-
}
583-
584-
totalChanges++
585-
586-
// If dry-run, show preview
587-
if migrator.DryRun {
588-
originalContent, _ := os.ReadFile(filePath)
589-
preview := migrator.PreviewDiff(absPath, string(originalContent), content)
590-
fmt.Println(preview)
591-
} else {
592-
// Write the migration
593-
err = migrator.WriteMigration(filePath, content)
594-
if err != nil {
595-
fmt.Printf("Error writing %s: %v\n", absPath, err)
596-
hasErrors = true
597-
continue
598-
}
599-
600-
// Count how many replacements were made
601-
changeCount := strings.Count(content, "# TICKET:") - strings.Count(string(content), "# STORY:")
602-
if changeCount < 0 {
603-
changeCount = -changeCount
604-
}
605-
606-
fmt.Printf("Migrated: %s (%d change(s))\n", absPath, changeCount)
607-
}
608-
}
609-
}
610-
611-
// Print summary
612-
if totalFiles == 0 {
613-
fmt.Println("No files matched the provided pattern(s)")
614-
os.Exit(1)
615-
}
616-
617-
if verbose {
618-
fmt.Printf("\nProcessed %d file(s), %d file(s) with changes\n", totalFiles, totalChanges)
619-
}
620-
621-
if hasErrors {
622-
os.Exit(1)
623-
}
624-
}
625-
626507
// runLegacy handles the old command-line interface for backward compatibility
627508
func runLegacy(cmd *cobra.Command, args []string) {
628509
// Check for legacy flags
@@ -773,7 +654,7 @@ func main() {
773654
// Check for legacy usage (no subcommand)
774655
if len(os.Args) > 1 && !strings.HasPrefix(os.Args[1], "-") {
775656
// If first arg is not a flag and not a known command, assume it's a file (legacy)
776-
knownCommands := []string{"push", "pull", "schema", "migrate", "help", "completion"}
657+
knownCommands := []string{"push", "pull", "schema", "help", "completion"}
777658
isKnownCommand := false
778659
for _, cmd := range knownCommands {
779660
if os.Args[1] == cmd {

cmd/ticketr/main_cli_test.go

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -135,75 +135,6 @@ func TestPullCmd_Flags(t *testing.T) {
135135
}
136136
}
137137

138-
// TestMigrateCmd_AcceptsMultipleFiles tests migrate command with multiple file arguments
139-
func TestMigrateCmd_AcceptsMultipleFiles(t *testing.T) {
140-
var capturedArgs []string
141-
testMigrateCmd := &cobra.Command{
142-
Use: "migrate [file]",
143-
Args: cobra.MinimumNArgs(1),
144-
Run: func(cmd *cobra.Command, args []string) {
145-
capturedArgs = args
146-
},
147-
}
148-
149-
testMigrateCmd.SetArgs([]string{"file1.md", "file2.md", "file3.md"})
150-
err := testMigrateCmd.Execute()
151-
152-
if err != nil {
153-
t.Fatalf("Expected no error, got: %v", err)
154-
}
155-
156-
if len(capturedArgs) != 3 {
157-
t.Errorf("Expected 3 arguments, got %d", len(capturedArgs))
158-
}
159-
160-
expectedFiles := []string{"file1.md", "file2.md", "file3.md"}
161-
for i, expected := range expectedFiles {
162-
if capturedArgs[i] != expected {
163-
t.Errorf("Expected arg %d to be '%s', got '%s'", i, expected, capturedArgs[i])
164-
}
165-
}
166-
}
167-
168-
// TestMigrateCmd_WriteFlag tests migrate command --write flag
169-
func TestMigrateCmd_WriteFlag(t *testing.T) {
170-
var testWrite bool
171-
testMigrateCmd := &cobra.Command{
172-
Use: "migrate [file]",
173-
Args: cobra.MinimumNArgs(1),
174-
Run: func(cmd *cobra.Command, args []string) {
175-
testWrite, _ = cmd.Flags().GetBool("write")
176-
},
177-
}
178-
179-
testMigrateCmd.Flags().BoolVarP(&testWrite, "write", "w", false, "Write changes")
180-
181-
// Test with --write flag
182-
testMigrateCmd.SetArgs([]string{"test.md", "--write"})
183-
err := testMigrateCmd.Execute()
184-
185-
if err != nil {
186-
t.Fatalf("Expected no error, got: %v", err)
187-
}
188-
189-
if !testWrite {
190-
t.Error("Expected write flag to be true")
191-
}
192-
193-
// Test without --write flag
194-
testWrite = false
195-
testMigrateCmd.SetArgs([]string{"test.md"})
196-
err = testMigrateCmd.Execute()
197-
198-
if err != nil {
199-
t.Fatalf("Expected no error, got: %v", err)
200-
}
201-
202-
if testWrite {
203-
t.Error("Expected write flag to be false")
204-
}
205-
}
206-
207138
// TestConfigFile_Override tests that --config flag overrides default config location
208139
func TestConfigFile_Override(t *testing.T) {
209140
var testCfgFile string
@@ -378,13 +309,6 @@ func TestCommandHelp(t *testing.T) {
378309
Short: "Pull tickets from JIRA",
379310
},
380311
},
381-
{
382-
name: "migrate",
383-
command: &cobra.Command{
384-
Use: "migrate [file]",
385-
Short: "Migrate legacy format",
386-
},
387-
},
388312
{
389313
name: "schema",
390314
command: &cobra.Command{

0 commit comments

Comments
 (0)