init-session.ps1 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. # Initialize planning files for a new session
  2. # Usage: .\init-session.ps1 [-Template TYPE] [project-name]
  3. # Templates: default, analytics
  4. param(
  5. [string]$ProjectName = "project",
  6. [string]$Template = "default"
  7. )
  8. $DATE = Get-Date -Format "yyyy-MM-dd"
  9. # Resolve template directory (skill root is one level up from scripts/)
  10. $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
  11. $SkillRoot = Split-Path -Parent $ScriptDir
  12. $TemplateDir = Join-Path $SkillRoot "templates"
  13. Write-Host "Initializing planning files for: $ProjectName (template: $Template)"
  14. # Validate template
  15. if ($Template -ne "default" -and $Template -ne "analytics") {
  16. Write-Host "Unknown template: $Template (available: default, analytics). Using default."
  17. $Template = "default"
  18. }
  19. # Create task_plan.md if it doesn't exist
  20. if (-not (Test-Path "task_plan.md")) {
  21. $AnalyticsPlan = Join-Path $TemplateDir "analytics_task_plan.md"
  22. if ($Template -eq "analytics" -and (Test-Path $AnalyticsPlan)) {
  23. Copy-Item $AnalyticsPlan "task_plan.md"
  24. } else {
  25. @"
  26. # Task Plan: [Brief Description]
  27. ## Goal
  28. [One sentence describing the end state]
  29. ## Current Phase
  30. Phase 1
  31. ## Phases
  32. ### Phase 1: Requirements & Discovery
  33. - [ ] Understand user intent
  34. - [ ] Identify constraints
  35. - [ ] Document in findings.md
  36. - **Status:** in_progress
  37. ### Phase 2: Planning & Structure
  38. - [ ] Define approach
  39. - [ ] Create project structure
  40. - **Status:** pending
  41. ### Phase 3: Implementation
  42. - [ ] Execute the plan
  43. - [ ] Write to files before executing
  44. - **Status:** pending
  45. ### Phase 4: Testing & Verification
  46. - [ ] Verify requirements met
  47. - [ ] Document test results
  48. - **Status:** pending
  49. ### Phase 5: Delivery
  50. - [ ] Review outputs
  51. - [ ] Deliver to user
  52. - **Status:** pending
  53. ## Decisions Made
  54. | Decision | Rationale |
  55. |----------|-----------|
  56. ## Errors Encountered
  57. | Error | Resolution |
  58. |-------|------------|
  59. "@ | Out-File -FilePath "task_plan.md" -Encoding UTF8
  60. }
  61. Write-Host "Created task_plan.md"
  62. } else {
  63. Write-Host "task_plan.md already exists, skipping"
  64. }
  65. # Create findings.md if it doesn't exist
  66. if (-not (Test-Path "findings.md")) {
  67. $AnalyticsFindings = Join-Path $TemplateDir "analytics_findings.md"
  68. if ($Template -eq "analytics" -and (Test-Path $AnalyticsFindings)) {
  69. Copy-Item $AnalyticsFindings "findings.md"
  70. } else {
  71. @"
  72. # Findings & Decisions
  73. ## Requirements
  74. -
  75. ## Research Findings
  76. -
  77. ## Technical Decisions
  78. | Decision | Rationale |
  79. |----------|-----------|
  80. ## Issues Encountered
  81. | Issue | Resolution |
  82. |-------|------------|
  83. ## Resources
  84. -
  85. "@ | Out-File -FilePath "findings.md" -Encoding UTF8
  86. }
  87. Write-Host "Created findings.md"
  88. } else {
  89. Write-Host "findings.md already exists, skipping"
  90. }
  91. # Create progress.md if it doesn't exist
  92. if (-not (Test-Path "progress.md")) {
  93. if ($Template -eq "analytics") {
  94. @"
  95. # Progress Log
  96. ## Session: $DATE
  97. ### Current Status
  98. - **Phase:** 1 - Data Discovery
  99. - **Started:** $DATE
  100. ### Actions Taken
  101. -
  102. ### Query Log
  103. | Query | Result Summary | Interpretation |
  104. |-------|---------------|----------------|
  105. ### Errors
  106. | Error | Resolution |
  107. |-------|------------|
  108. "@ | Out-File -FilePath "progress.md" -Encoding UTF8
  109. } else {
  110. @"
  111. # Progress Log
  112. ## Session: $DATE
  113. ### Current Status
  114. - **Phase:** 1 - Requirements & Discovery
  115. - **Started:** $DATE
  116. ### Actions Taken
  117. -
  118. ### Test Results
  119. | Test | Expected | Actual | Status |
  120. |------|----------|--------|--------|
  121. ### Errors
  122. | Error | Resolution |
  123. |-------|------------|
  124. "@ | Out-File -FilePath "progress.md" -Encoding UTF8
  125. }
  126. Write-Host "Created progress.md"
  127. } else {
  128. Write-Host "progress.md already exists, skipping"
  129. }
  130. Write-Host ""
  131. Write-Host "Planning files initialized!"
  132. Write-Host "Files: task_plan.md, findings.md, progress.md"