4.6 KiB
Standard Init Script Templates Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Add standard CISD post-init script templates to the repository and document how TMS should reference them after deployment to /home/tms/bin.
Architecture: Keep the runtime command model unchanged in TMS. Add script templates under the repository so deployment has a clear source of truth, then point application.yml.example and README.md to the deployed absolute paths. Tests only verify the repository artifacts and expected command content, not real database or nginx execution.
Tech Stack: Shell scripts, Spring Boot config examples, JUnit 5 filesystem assertions
Task 1: Add repository script templates
Files:
- Create:
/Users/waner/Work/CISD/文档/tms-framework/scripts/standard-init/apply_standard_db.sh - Create:
/Users/waner/Work/CISD/文档/tms-framework/scripts/standard-init/start_standard_apps.sh - Create:
/Users/waner/Work/CISD/文档/tms-framework/scripts/standard-init/start_standard_nginx.sh - Create:
/Users/waner/Work/CISD/文档/tms-framework/scripts/standard-init/check_standard_runtime.sh - Test:
/Users/waner/Work/CISD/文档/tms-framework/src/test/java/com/cisd/tms/modules/init/executor/ConfigurableInitStepExecutorTest.java
Step 1: Write the failing test
Add tests that assert the four script files exist in scripts/standard-init/ and contain the expected key commands:
- DB script references
SCHEMA-DDL.sql,CMEP.sql,UP-ORG-INFO.sql - App start script references
start_cmsp.shandstart_cmtp.sh - Nginx start script references
/usr/local/nginx/sbin/nginx - Post-check script references CMSP/CMTP/nginx process checks and
organization.json
Step 2: Run test to verify it fails
Run: mvn -q -Dtest=ConfigurableInitStepExecutorTest#shouldExposeStandardInitScriptTemplates test
Expected: FAIL because the scripts do not exist yet.
Step 3: Write minimal implementation
Create the four scripts with:
#!/bin/bashset -euo pipefail- environment variable placeholders for preset credentials where needed
- comments limited to critical operational assumptions
Step 4: Run test to verify it passes
Run: mvn -q -Dtest=ConfigurableInitStepExecutorTest#shouldExposeStandardInitScriptTemplates test
Expected: PASS
Step 5: Commit
git add scripts/standard-init src/test/java/com/cisd/tms/modules/init/executor/ConfigurableInitStepExecutorTest.java
git commit -m "feat: add standard init script templates"
Task 2: Wire deployment-facing config examples
Files:
- Modify:
/Users/waner/Work/CISD/文档/tms-framework/config/application.yml.example - Modify:
/Users/waner/Work/CISD/文档/tms-framework/README.md - Test:
/Users/waner/Work/CISD/文档/tms-framework/src/test/java/com/cisd/tms/modules/init/executor/ConfigurableInitStepExecutorTest.java
Step 1: Write the failing test
Add a test that asserts:
application.yml.examplepoints the four command properties to/home/tms/bin/*.shREADME.mddocuments the repository source pathscripts/standard-init/and the target deploy path/home/tms/bin
Step 2: Run test to verify it fails
Run: mvn -q -Dtest=ConfigurableInitStepExecutorTest#shouldDocumentStandardInitScriptTemplateDeployment test
Expected: FAIL because the docs/config are not updated yet.
Step 3: Write minimal implementation
Update example config and README with:
- exact deployed command values
- copy/deploy note from
scripts/standard-init/to/home/tms/bin - required environment variables for DB script
Step 4: Run test to verify it passes
Run: mvn -q -Dtest=ConfigurableInitStepExecutorTest#shouldDocumentStandardInitScriptTemplateDeployment test
Expected: PASS
Step 5: Commit
git add config/application.yml.example README.md src/test/java/com/cisd/tms/modules/init/executor/ConfigurableInitStepExecutorTest.java
git commit -m "docs: wire standard init script template deployment"
Task 3: Final verification
Files:
- Verify only
Step 1: Run focused tests
Run: mvn -q -Dtest=ConfigurableInitStepExecutorTest test
Expected: PASS
Step 2: Run init test suite
Run: mvn -q -Dtest=InitServiceTest,ConfigurableInitStepExecutorTest test
Expected: PASS
Step 3: Run compile
Run: mvn -q -DskipTests compile
Expected: PASS
Step 4: Review git diff
Run: git diff -- scripts/standard-init config/application.yml.example README.md src/test/java/com/cisd/tms/modules/init/executor/ConfigurableInitStepExecutorTest.java
Expected: only script templates, config example, README, and tests changed.