Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "firstspirit-fs-cli",
|
||||
"description": "Knowledge how to use the FirstSpirit fs-cli to sync templates locally from and to a FirstSpirit project",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "rawe",
|
||||
"email": "noreply@example.com"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# firstspirit-fs-cli
|
||||
|
||||
Knowledge how to use the FirstSpirit fs-cli to sync templates locally from and to a FirstSpirit project
|
||||
77
plugin.lock.json
Normal file
77
plugin.lock.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:rawe/claude-dev-skills:firstspirit-fs-cli",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "faa4177e2911c4c5cc2bcbb5d15911ba1567323b",
|
||||
"treeHash": "6da2b53d15d86ab9c2829a3778abbed55c39f6dd337d74d4f552aec342260ab4",
|
||||
"generatedAt": "2025-11-28T10:27:49.220715Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "firstspirit-fs-cli",
|
||||
"description": "Knowledge how to use the FirstSpirit fs-cli to sync templates locally from and to a FirstSpirit project",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "e1da668ada10503df97f0c442f8df3584448a2ba7ae1ac0960fdb664e4e3743d"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "d60914395326b61f550c07a73ea13a978e3684e9157a9da2019a0c1aaa17ee6d"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/SKILL.md",
|
||||
"sha256": "730baa609b8ddc4f524ede99a96b430e312bca9fc74e338fa4ec23d496da776a"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/scripts/setup-fs-cli.sh",
|
||||
"sha256": "36dcba306f61f8adc236be6d9d77b75ff5f200e95fba869fdce00b0e16766417"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/scripts/validate-environment.sh",
|
||||
"sha256": "6d082d7f296a04c8cf28f00cfc7f928b15c9a926e736c24a61db7cb293d3a1c7"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/templates/.gitignore.fs-cli",
|
||||
"sha256": "1836c6c2582c2643577a37ed8467dd401f03f51d6b8e47aada8893ef112741ac"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/templates/.env.template",
|
||||
"sha256": "92b5d97eb89d0e756f71da9595bb6fecfabf7ca1283c163938ecde96c54383d4"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/templates/.env.example.template",
|
||||
"sha256": "a8c504b6a8a2ad80579e1b7ce1cdba49ca4288e89c6ab0b08be1aa394d1b5be6"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/reference/fs-cli-usage.md",
|
||||
"sha256": "162d750aac7b39dc5c84e027d6a5865a40460a6d27de751d0cfef330ca2adc2c"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/reference/fs-cli-installation-guide.md",
|
||||
"sha256": "05939873188d9dfeb32105b9b42240abd31361edecb8b81b1d76664312f9166a"
|
||||
},
|
||||
{
|
||||
"path": "skills/firstspirit-fs-cli/reference/fs-cli-sync-structure.md",
|
||||
"sha256": "327f7ab6f9b595872e470eb93e38b47937de583fe75377497e525f3a0263efd0"
|
||||
}
|
||||
],
|
||||
"dirSha256": "6da2b53d15d86ab9c2829a3778abbed55c39f6dd337d74d4f552aec342260ab4"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
286
skills/firstspirit-fs-cli/SKILL.md
Normal file
286
skills/firstspirit-fs-cli/SKILL.md
Normal file
@@ -0,0 +1,286 @@
|
||||
---
|
||||
name: firstspirit-fs-cli
|
||||
description: FirstSpirit CMS template development using fs-cli. Helps set up fs-cli environment, export templates from FirstSpirit server, modify templates with Claude Code, and import changes back to server. Use when working with FirstSpirit templates, CMS development, or when user mentions fs-cli, FirstSpirit, or template synchronization.
|
||||
---
|
||||
|
||||
# FirstSpirit CLI Skill
|
||||
|
||||
You are a specialized assistant for working with FirstSpirit templates using the fs-cli tool.
|
||||
|
||||
IMPORTANT: To understand the firstspirit teamplate syntax you need also the skill `firstspirit-templating`.
|
||||
|
||||
## Knowledge Base
|
||||
|
||||
Before working with FirstSpirit templates, you MUST familiarize yourself with these supporting files in the `reference/` directory:
|
||||
|
||||
1. **`reference/fs-cli-sync-structure.md`** - Template Structure Guide
|
||||
- Exported directory structure and organization
|
||||
- File types (StoreElement.xml, GomSource.xml, ChannelSource, etc.)
|
||||
- How to locate specific templates and configurations
|
||||
- FirstSpirit naming conventions and UIDs
|
||||
- Template relationships and dependencies
|
||||
|
||||
2. **`reference/fs-cli-installation-guide.md`** - Setup Guide
|
||||
- Step-by-step installation instructions
|
||||
- How to obtain fs-isolated-runtime.jar
|
||||
- Environment validation procedures
|
||||
- Troubleshooting
|
||||
|
||||
3. **`reference/fs-cli-usage.md`** - Command Reference
|
||||
- Common fs-cli commands with examples
|
||||
- Environment variable usage
|
||||
- Export/import workflows
|
||||
- Command parameters and options
|
||||
|
||||
## Your Primary Capabilities
|
||||
|
||||
1. **Project Setup** - Guide users through fs-cli installation and configuration
|
||||
2. **Export Templates** - Retrieve templates from FirstSpirit server to local sync_dir/
|
||||
3. **Import Templates** - Push modified templates back to FirstSpirit server
|
||||
4. **Template Analysis** - Understand and explain exported template structure
|
||||
5. **Template Modification** - Edit templates following FirstSpirit syntax and conventions
|
||||
|
||||
## Setup Workflow
|
||||
|
||||
**IMPORTANT**: this must done only once per project. NOT every time the user wants to run commands.
|
||||
|
||||
### Detecting Setup Status
|
||||
|
||||
Check if fs-cli is configured before running commands:
|
||||
|
||||
```bash
|
||||
if [ ! -d .fs-cli ]; then
|
||||
echo "fs-cli not configured. Starting setup wizard..."
|
||||
fi
|
||||
```
|
||||
|
||||
### First-Time Project Setup
|
||||
|
||||
When a user needs to set up fs-cli the first time in their project: read the `reference/fs-cli-installation-guide.md` file and guide them through.
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables (.env)
|
||||
|
||||
All fs-cli configuration is stored in `.env`:
|
||||
|
||||
```bash
|
||||
# FirstSpirit Server Configuration
|
||||
fshost=localhost
|
||||
fsport=8000
|
||||
fsmode=HTTP
|
||||
fsproject=my-project
|
||||
|
||||
# FirstSpirit Credentials (KEEP SECRET - DO NOT COMMIT)
|
||||
fsuser=Admin
|
||||
fspwd=your_password
|
||||
|
||||
# fs-cli Configuration (for reference only, not used by fs-cli)
|
||||
FS_CLI_VERSION=4.8.6
|
||||
FS_VERSION=2025.01
|
||||
```
|
||||
|
||||
**IMPORTANT:** Never commit `.env` to git! It contains credentials.
|
||||
|
||||
### Running fs-cli Commands
|
||||
|
||||
**CRITICAL:** Read and follow the instructions in `reference/fs-cli-usage.md` for common commands and usage examples before running any commands.
|
||||
|
||||
Always export environment variables from `.env` before running fs-cli commands:
|
||||
|
||||
```bash
|
||||
# Export environment variables from .env (use set -a to auto-export all variables)
|
||||
set -a && source .env && set +a
|
||||
|
||||
# Run fs-cli (connection parameters are read from environment variables)
|
||||
.fs-cli/bin/fs-cli.sh <command> [args]
|
||||
```
|
||||
|
||||
**Note:** Use `set -a; source .env; set +a` to properly export all variables from the `.env` file. The `.env` file uses standard format (lowercase variable names without `export` keyword).
|
||||
|
||||
See `reference/fs-cli-usage.md` for common commands and examples.
|
||||
|
||||
## Template Modification Workflow
|
||||
|
||||
### 1. Export Templates
|
||||
|
||||
Always export before modifying to get the latest version from the server:
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export
|
||||
```
|
||||
|
||||
### 2. Understand Template Structure
|
||||
|
||||
**CRITICAL:** Read `reference/fs-cli-sync-structure.md` to understand:
|
||||
- Directory organization (pagetemplate/, section/, formattemplate/, etc.)
|
||||
- File types and their purposes
|
||||
- How to locate specific templates
|
||||
- XML structure and metadata
|
||||
|
||||
Key files in exported structure:
|
||||
- `StoreElement.xml` - Contains metadata (name, UID, type)
|
||||
- `GomSource.xml` - Contains template source code (for sections, page templates)
|
||||
- Channel-specific files - Media variants and formats
|
||||
|
||||
### 3. Locate Templates
|
||||
|
||||
Use Glob and Grep to find templates:
|
||||
|
||||
```bash
|
||||
# Find all page templates
|
||||
ls sync_dir/pagetemplate/
|
||||
|
||||
# Search for template by name
|
||||
grep -r "template-name" sync_dir/
|
||||
|
||||
# Find by UID
|
||||
grep -r 'uid="homepage"' sync_dir/
|
||||
|
||||
# Find specific input component
|
||||
grep -r "CMS_INPUT_TEXT" sync_dir/
|
||||
```
|
||||
|
||||
### 4. Modify Templates
|
||||
|
||||
When editing templates:
|
||||
|
||||
- **Preserve XML structure** - Don't break XML syntax
|
||||
- **Keep UIDs intact** - Unless explicitly renaming elements
|
||||
- **Follow FirstSpirit syntax** - Use proper template language constructs
|
||||
- **Don't modify metadata** unnecessarily
|
||||
- **Test incrementally** - Make small changes, test, iterate
|
||||
|
||||
Common files to edit:
|
||||
- `StoreElement.xml` - For metadata changes
|
||||
- `GomSource.xml` - For template logic and HTML
|
||||
- Input component definitions - For form fields
|
||||
|
||||
### 5. Import Changes Back
|
||||
|
||||
After modifying templates:
|
||||
|
||||
```bash
|
||||
# Optional: Dry run first
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ import --dry-run
|
||||
|
||||
# Import for real
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ import
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
### Connection Errors
|
||||
|
||||
- Let the user verify the `.env` configuration is correct
|
||||
- Check server accessibility: `telnet ${fshost} ${fsport}`
|
||||
- Validate credentials with FirstSpirit administrator
|
||||
- Ensure connection mode (HTTP/HTTPS/SOCKET) is correct
|
||||
- Check firewall and network access
|
||||
|
||||
### Java Errors
|
||||
|
||||
- Ensure Java 17+ is installed: `java -version`
|
||||
- Check JAVA_HOME: `echo $JAVA_HOME`
|
||||
- Verify fs-isolated-runtime.jar version matches FirstSpirit server exactly
|
||||
|
||||
### Missing fs-isolated-runtime.jar
|
||||
|
||||
- User MUST manually obtain this file
|
||||
- Cannot proceed without it
|
||||
- Display instructions from `reference/fs-cli-installation-guide.md`
|
||||
- Jar version MUST match FirstSpirit server version
|
||||
|
||||
### Import/Export Failures
|
||||
|
||||
- Check fs-cli logs for error details
|
||||
- Verify project name matches server
|
||||
- Ensure user has proper permissions in FirstSpirit
|
||||
- Check for syntax errors in modified templates
|
||||
- Validate XML structure is well-formed
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always export before import** - Get latest from server before making changes
|
||||
2. **Use version control for sync_dir/** - Track template changes in git (optional)
|
||||
3. **Test in dev environment first** - Never test directly in production
|
||||
4. **Understand template structure** - Read documentation before editing
|
||||
5. **Keep .env secret** - Never commit credentials to git
|
||||
6. **Match jar version exactly** - fs-isolated-runtime.jar must match FS server version
|
||||
7. **Make incremental changes** - Small changes are easier to debug
|
||||
8. **Use dry-run** - Test imports before applying to server
|
||||
9. **Preserve UIDs** - Don't modify UIDs unless you know what you're doing
|
||||
10. **Follow FirstSpirit conventions** - Use proper template syntax and naming
|
||||
|
||||
## Project Directory Structure
|
||||
|
||||
After setup, the project will look like:
|
||||
|
||||
```
|
||||
your-project/
|
||||
├── .env # Configuration + credentials (gitignored)
|
||||
├── .env.example # Template for team (committed)
|
||||
├── .gitignore # Updated to ignore .fs-cli/ and .env
|
||||
│
|
||||
├── .fs-cli/ # Git-ignored - local fs-cli installation
|
||||
│ ├── bin/
|
||||
│ │ └── fs-cli.sh # The CLI executable (for mac and linux)
|
||||
│ │ └── fs-cli.cmd # The CLI executable (for windows)
|
||||
│ ├── lib/
|
||||
│ │ └── fs-isolated-runtime.jar # USER MUST PROVIDE (version-specific)
|
||||
│ ├── README.txt # fs-cli documentation
|
||||
│ └── .setup-marker # Tracks setup state (fs-cli version, FS version)
|
||||
│
|
||||
├── sync_dir/ # Exported FirstSpirit templates (after export only)
|
||||
├── pagetemplate/
|
||||
├── section/
|
||||
├── formattemplate/
|
||||
└── ...
|
||||
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
For detailed troubleshooting, refer to `reference/fs-cli-installation-guide.md`.
|
||||
|
||||
|
||||
## Supporting Files in This Skill
|
||||
|
||||
Located in the skill directory:
|
||||
|
||||
- `reference/fs-cli-sync-structure.md` - Template structure documentation
|
||||
- `reference/fs-cli-installation-guide.md` - Detailed setup and troubleshooting guide
|
||||
- `reference/fs-cli-usage.md` - Common fs-cli commands and usage examples
|
||||
- `scripts/setup-fs-cli.sh` - Automated setup script
|
||||
- `scripts/validate-environment.sh` - Environment validation script
|
||||
- `templates/.env.template` - Template for .env file
|
||||
- `templates/.env.example.template` - Template for .env.example
|
||||
- `templates/.gitignore.fs-cli` - Lines to add to .gitignore
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
This skill will expand to support:
|
||||
- Custom JAR functionality (additional libraries in lib/)
|
||||
- More fs-cli commands (test, deploy, module management)
|
||||
- Template scaffolding and generation
|
||||
- Automated template validation
|
||||
- External sync version control workflows
|
||||
- Integration with FirstSpirit ServerManager
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
Claude will automatically invoke this skill when:
|
||||
- User mentions "FirstSpirit" or "fs-cli"
|
||||
- User wants to export or import templates
|
||||
- User needs help with FirstSpirit template development
|
||||
- User mentions template synchronization or CMS development
|
||||
- User is working in a project with .fs-cli/ directory
|
||||
|
||||
## Important Reminders
|
||||
|
||||
- **Never commit `.env`** - Contains credentials
|
||||
- **Never commit `.fs-cli/`** - Downloaded tools, version-specific
|
||||
- **`.env.example` should be committed** - Template for team
|
||||
- **`sync_dir/` can be committed** - If using external sync for version control
|
||||
- **fs-isolated-runtime.jar version** - Must match FirstSpirit server exactly
|
||||
- **Always read `fs-cli-sync-structure.md`** - Before modifying templates
|
||||
233
skills/firstspirit-fs-cli/reference/fs-cli-installation-guide.md
Normal file
233
skills/firstspirit-fs-cli/reference/fs-cli-installation-guide.md
Normal file
@@ -0,0 +1,233 @@
|
||||
# FirstSpirit CLI Installation Guide
|
||||
|
||||
This guide walks you through setting up fs-cli for your FirstSpirit project.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **Java 17 or higher** installed locally
|
||||
- **JAVA_HOME** environment variable set (recommended)
|
||||
- Access to a FirstSpirit server
|
||||
- FirstSpirit user credentials
|
||||
|
||||
## Setup Steps
|
||||
|
||||
### 1. Run the Setup Script
|
||||
|
||||
run the setup script:
|
||||
|
||||
```bash
|
||||
../scripts/setup-fs-cli.sh
|
||||
```
|
||||
|
||||
BE AWARE that this script is interactive and relative to this file here.
|
||||
|
||||
This script will:
|
||||
- Prompt for fs-cli version (default: 4.8.6)
|
||||
- Download and extract fs-cli to `.fs-cli/`
|
||||
- Prompt for your FirstSpirit version
|
||||
- Guide you through obtaining `fs-isolated-runtime.jar`
|
||||
- Create the `.env` and `.env.example` files
|
||||
- Update `.gitignore`
|
||||
|
||||
### 2. Obtain fs-isolated-runtime.jar
|
||||
|
||||
**This is the only manual step.**
|
||||
|
||||
The `fs-isolated-runtime.jar` file must match your FirstSpirit server version exactly.
|
||||
|
||||
#### Option A: From FirstSpirit Server
|
||||
|
||||
The fs-isolated-runtime jar is located in the server installation directory `[serverRoot]/data/fslib`
|
||||
|
||||
|
||||
#### Option B: From Crownpeaks file server
|
||||
|
||||
1. Login to (https://file.crownpeak.com)
|
||||
2. Navigate to Downloads → FirstSpirit → Your Version
|
||||
3. Find and Download `fs-isolated-runtime.jar`
|
||||
4. Copy to: `.fs-cli/lib/fs-isolated-runtime.jar`
|
||||
|
||||
**Important**: The jar version must match your FirstSpirit server version exactly (e.g., 2025.01, 2024.09, etc.)
|
||||
|
||||
### 3. Validate Environment
|
||||
|
||||
Run the validation script:
|
||||
|
||||
```bash
|
||||
../scripts/validate-environment.sh
|
||||
```
|
||||
|
||||
BE AWARE that this script is elative to this file here.
|
||||
|
||||
This checks:
|
||||
- Java 17+ is installed
|
||||
- JAVA_HOME is set (optional but recommended)
|
||||
- fs-cli is extracted properly
|
||||
- fs-isolated-runtime.jar is in place
|
||||
- fs-cli can run
|
||||
|
||||
### 4. Start Using fs-cli
|
||||
|
||||
Once validation passes, you can:
|
||||
|
||||
- Use the FirstSpirit skill in Claude Code
|
||||
- Run fs-cli directly: `.fs-cli/bin/fs-cli`
|
||||
- Use export/import commands
|
||||
|
||||
## Configuration
|
||||
|
||||
All configuration is stored in `.env`:
|
||||
|
||||
```bash
|
||||
# FirstSpirit Server Configuration
|
||||
fshost=localhost
|
||||
fsport=8000
|
||||
fsmode=HTTP
|
||||
fsproject=my-project
|
||||
|
||||
# FirstSpirit Credentials (KEEP SECRET - DO NOT COMMIT)
|
||||
fsuser=Admin
|
||||
fspwd=your_password
|
||||
|
||||
# fs-cli Configuration (for reference only, not used by fs-cli)
|
||||
FS_CLI_VERSION=4.8.6
|
||||
FS_VERSION=2025.01
|
||||
```
|
||||
|
||||
**Never commit `.env` to git!** Use `.env.example` as a template for your team.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Java Version Issues
|
||||
|
||||
Check your Java version:
|
||||
|
||||
```bash
|
||||
java -version
|
||||
```
|
||||
|
||||
You need Java 17 or higher. On macOS with multiple Java versions:
|
||||
|
||||
```bash
|
||||
# Set Java 17
|
||||
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
|
||||
|
||||
# Or Java 21
|
||||
export JAVA_HOME=$(/usr/libexec/java_home -v 21)
|
||||
```
|
||||
|
||||
Add to your shell profile (`~/.zshrc` or `~/.bashrc`):
|
||||
|
||||
```bash
|
||||
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
|
||||
```
|
||||
|
||||
### fs-isolated-runtime.jar Version Mismatch
|
||||
|
||||
**Symptom**: Connection errors or runtime exceptions
|
||||
|
||||
**Solution**: Ensure jar version exactly matches your FirstSpirit server version. Check your server version:
|
||||
|
||||
```bash
|
||||
# In FirstSpirit ServerManager or ask your admin
|
||||
```
|
||||
|
||||
### Permission Denied on fs-cli
|
||||
|
||||
```bash
|
||||
chmod +x .fs-cli/bin/fs-cli
|
||||
```
|
||||
|
||||
### Connection Failures
|
||||
|
||||
1. **Verify server is running**:
|
||||
```bash
|
||||
telnet $fshost $fsport
|
||||
```
|
||||
|
||||
2. **Check credentials** in `.env`
|
||||
|
||||
3. **Verify connection mode**: HTTP vs HTTPS vs SOCKET
|
||||
|
||||
4. **Check firewall/network access**: Ensure your machine can reach the FS server
|
||||
|
||||
5. **Test with fs-cli directly**:
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh test
|
||||
```
|
||||
|
||||
### Download Failures
|
||||
|
||||
If GitHub download fails:
|
||||
|
||||
```bash
|
||||
# Manually download from:
|
||||
# https://github.com/e-Spirit/FSDevTools/releases/download/VERSION/fs-cli-VERSION.tar.gz
|
||||
|
||||
# Extract manually:
|
||||
tar -xzf fs-cli-VERSION.tar.gz -C .fs-cli/
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
After setup:
|
||||
|
||||
```
|
||||
your-project/
|
||||
├── .env # Your config (gitignored)
|
||||
├── .env.example # Template (committed)
|
||||
├── .gitignore # Ignores .fs-cli/ and .env
|
||||
├── .fs-cli/ # Gitignored
|
||||
│ ├── bin/
|
||||
│ │ └── fs-cli # The CLI executable
|
||||
│ ├── lib/
|
||||
│ │ └── fs-isolated-runtime.jar # You provide (version-specific)
|
||||
│ └── .setup-marker # Tracks setup state (fs-cli version, FS version)
|
||||
├── sync_dir/ # FirstSpirit templates (exported)
|
||||
└── scripts/ # Optional convenience scripts
|
||||
```
|
||||
|
||||
## Working with Multiple Environments
|
||||
|
||||
Each project connects to one FirstSpirit server version. If you have multiple environments (dev, staging, prod) with the same FS version, you can use different .env files:
|
||||
|
||||
```bash
|
||||
.env # Default environment
|
||||
.env.prod # Production
|
||||
.env.staging # Staging
|
||||
|
||||
# Switch environments by sourcing different .env files:
|
||||
set -a && source .env.prod && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export
|
||||
```
|
||||
|
||||
**Note**: All environments in a project should use the same FirstSpirit version since the fs-isolated-runtime.jar is version-specific.
|
||||
|
||||
## Advanced: Adding Custom JARs
|
||||
|
||||
For future custom functionality:
|
||||
|
||||
```bash
|
||||
# Add your custom JAR to fs-cli classpath
|
||||
cp your-custom-tool.jar .fs-cli/lib/
|
||||
```
|
||||
|
||||
The fs-cli will automatically include all JARs in the lib folder.
|
||||
|
||||
## Next Steps
|
||||
|
||||
Once installation is complete:
|
||||
|
||||
1. **Learn the commands**: Read `fs-cli-usage.md` for common fs-cli commands and usage examples
|
||||
2. **Understand template structure**: Read `fs-cli-sync-structure.md` to understand the exported template structure
|
||||
3. **Start working**: Use the FirstSpirit skill in Claude Code to work with templates
|
||||
4. **Optional**: Set up version control for `sync_dir/` if using external sync
|
||||
|
||||
## Getting Help
|
||||
|
||||
If you encounter issues:
|
||||
|
||||
1. Run diagnostics: `bash validate-environment.sh`
|
||||
2. Check this guide's troubleshooting section
|
||||
3. Review fs-cli README: `.fs-cli/README.txt`
|
||||
4. Check FirstSpirit server logs
|
||||
5. Contact your FirstSpirit administrator
|
||||
410
skills/firstspirit-fs-cli/reference/fs-cli-sync-structure.md
Normal file
410
skills/firstspirit-fs-cli/reference/fs-cli-sync-structure.md
Normal file
@@ -0,0 +1,410 @@
|
||||
# FirstSpirit FS-CLI Export/Sync Directory Structure
|
||||
|
||||
## Overview
|
||||
|
||||
This document describes the structure and file formats used when exporting FirstSpirit templates using FS-CLI (FSDevTools). The export creates a hierarchical file system structure that mirrors the FirstSpirit project structure, preserving all template configurations, forms, rules, and output channels.
|
||||
|
||||
## General Structure
|
||||
|
||||
The FS-CLI export follows a consistent pattern:
|
||||
|
||||
```
|
||||
sync_dir/
|
||||
├── .FirstSpirit/ # Export metadata (do not version control)
|
||||
│ ├── Files_*.txt # List of all exported files with checksums
|
||||
│ └── Import_*.txt # Import metadata
|
||||
│
|
||||
└── TemplateStore/ # Template Store root
|
||||
├── FormatTemplates/ # Text formatting templates
|
||||
├── LinkTemplates/ # Link templates
|
||||
├── PageTemplates/ # Page templates
|
||||
├── SectionTemplates/ # Section templates (content modules)
|
||||
├── Schemes/ # Database schema templates
|
||||
├── Scripts/ # Script templates
|
||||
└── Workflows/ # Workflow definitions
|
||||
```
|
||||
|
||||
### Key Principles
|
||||
|
||||
1. **Folder hierarchy mirrors FirstSpirit structure**: The file system replicates the exact folder structure from the FirstSpirit project
|
||||
2. **One folder per element**: Each FirstSpirit template/element gets its own directory
|
||||
3. **Consistent file naming**: Files use standardized names based on their purpose
|
||||
4. **Multiple files per template**: Templates are decomposed into separate files for different aspects (form, output, rules, etc.)
|
||||
|
||||
## Template Store Structure
|
||||
|
||||
### Template Types and Locations
|
||||
|
||||
| Template Type | Directory | Purpose |
|
||||
|--------------|-----------|---------|
|
||||
| **Page Templates** | `TemplateStore/PageTemplates/` | Define page framework and structure |
|
||||
| **Section Templates** | `TemplateStore/SectionTemplates/` | Content modules inserted into pages |
|
||||
| **Format Templates** | `TemplateStore/FormatTemplates/` | Text formatting options for editors |
|
||||
| **Link Templates** | `TemplateStore/LinkTemplates/` | Link type configurations |
|
||||
| **Table Templates** | `TemplateStore/Schemes/` | Database schema templates |
|
||||
| **Script Templates** | `TemplateStore/Scripts/` | BeanShell scripts and functions |
|
||||
| **Workflows** | `TemplateStore/Workflows/` | Approval and release workflows |
|
||||
|
||||
## File Types Reference
|
||||
|
||||
Each template directory contains a combination of the following files, depending on the template type:
|
||||
|
||||
### Core Files (All Templates)
|
||||
|
||||
#### StoreElement.xml
|
||||
**Purpose**: Core template metadata and configuration
|
||||
|
||||
**Contains**:
|
||||
- Template ID (`id` attribute) - unique identifier
|
||||
- Template reference name (`filename` or `name` attribute)
|
||||
- Template type (`type` attribute: `page`, `section`, `format`, etc.)
|
||||
- Display names (multilingual via `<LANG>` elements)
|
||||
- Channel/extension mappings (`<EXTENSION>` elements)
|
||||
- Template body definitions (`<TEMPLATEBODY>`)
|
||||
- Format template style definitions (`<style>` for format templates)
|
||||
|
||||
#### FS_Files.txt
|
||||
**Purpose**: File registry with metadata for all files in the template directory
|
||||
|
||||
**Contains**: Tab-delimited list with checksum, file size, timestamp, MIME type, and filename for each file
|
||||
|
||||
#### FS_Info.txt
|
||||
**Purpose**: Additional metadata about the template element
|
||||
|
||||
**Contains**: Template information, creation/modification dates, author information
|
||||
|
||||
#### FS_References.txt
|
||||
**Purpose**: Dependency tracking
|
||||
|
||||
**Contains**: References to other FirstSpirit elements that this template depends on or uses
|
||||
|
||||
### Form Definition Files
|
||||
|
||||
#### GomSource.xml
|
||||
**Purpose**: Form definition (GOM = GUI Object Model)
|
||||
|
||||
**Contains**:
|
||||
- Input component definitions (CMS_INPUT_*, FS_CATALOG, FS_INDEX, etc.)
|
||||
- Form field configurations
|
||||
- Labels and descriptions (multilingual via `<LANGINFO>`)
|
||||
- Layout and organization
|
||||
- Default values
|
||||
|
||||
#### GomDefaults.xml
|
||||
**Purpose**: Default values for GOM form fields (optional)
|
||||
|
||||
**Found in**: Style/Format templates primarily
|
||||
|
||||
**Contains**: Default values for form fields
|
||||
|
||||
### Output Channel Files
|
||||
|
||||
#### ChannelSource_[CHANNEL]_[EXTENSION].[EXTENSION]
|
||||
**Purpose**: Template output for specific delivery channels
|
||||
|
||||
**Naming pattern**: `ChannelSource_<ChannelName>_<extension>.<extension>`
|
||||
|
||||
**Common examples**:
|
||||
- `ChannelSource_HTML_html.html` - HTML output channel
|
||||
- `ChannelSource_XML_xml.xml` - XML output channel
|
||||
- `ChannelSource_JSON_json.json` - JSON output channel
|
||||
|
||||
**Contains**: FirstSpirit template syntax with output logic (HTML, XML, or other formats)
|
||||
|
||||
### Rule Definition Files
|
||||
|
||||
#### Ruleset.xml
|
||||
**Purpose**: Dynamic form behavior and validation rules
|
||||
|
||||
**Contains**:
|
||||
- Conditional visibility rules
|
||||
- Field dependency rules
|
||||
- Validation rules (SAVE, RELEASE, INFO severity)
|
||||
- Dynamic value calculations
|
||||
- Multi-language support rules
|
||||
|
||||
### Preview/Snippet Files
|
||||
|
||||
These files define how templates appear in preview mode and in template selection dialogs.
|
||||
|
||||
#### SnippetThumb.txt
|
||||
**Purpose**: Thumbnail/icon preview
|
||||
|
||||
**Contains**: Template syntax to generate small preview image or icon
|
||||
|
||||
#### SnippetHeader.txt
|
||||
**Purpose**: Header/title preview
|
||||
|
||||
**Contains**: Template syntax to generate preview title (often just the headline field)
|
||||
|
||||
#### SnippetExtract.txt
|
||||
**Purpose**: Content extract preview
|
||||
|
||||
**Contains**: Template syntax to generate preview text/excerpt
|
||||
|
||||
**Example**:
|
||||
```
|
||||
$CMS_IF(!pt_headline.isEmpty)$
|
||||
$CMS_VALUE(pt_headline.toText(false))$
|
||||
$CMS_END_IF$
|
||||
```
|
||||
|
||||
### Workflow-Specific Files
|
||||
|
||||
#### Workflow.xml
|
||||
**Purpose**: Complete workflow definition
|
||||
|
||||
**Contains**:
|
||||
- States (start, end, intermediate states)
|
||||
- Activities (tasks, actions)
|
||||
- Transitions (connections between states)
|
||||
- Email configurations
|
||||
- Permissions and rights
|
||||
- User/group assignments
|
||||
- Scripting logic
|
||||
|
||||
**Structure**: Java object serialization format describing the workflow graph
|
||||
|
||||
**Key Components**:
|
||||
- **States**: Workflow stages with permissions and duration
|
||||
- **Activities**: Tasks users perform
|
||||
- **Transitions**: Connections with email notifications and rights
|
||||
- **Coordinates**: Visual layout positions (x, y coordinates)
|
||||
|
||||
#### ViewScript.txt
|
||||
**Purpose**: Custom workflow display/view logic (optional)
|
||||
|
||||
**Contains**: BeanShell script for custom workflow UI
|
||||
|
||||
## Directory Organization by Template Type
|
||||
|
||||
### Page Templates
|
||||
```
|
||||
PageTemplates/
|
||||
└── pt_standard_page/
|
||||
├── StoreElement.xml # Template metadata
|
||||
├── GomSource.xml # Form definition
|
||||
├── Ruleset.xml # Form rules
|
||||
├── ChannelSource_HTML_html.html # HTML output
|
||||
├── SnippetThumb.txt # Thumbnail preview
|
||||
├── SnippetHeader.txt # Header preview
|
||||
├── SnippetExtract.txt # Extract preview
|
||||
├── FS_Files.txt # File registry
|
||||
├── FS_Info.txt # Metadata
|
||||
└── FS_References.txt # Dependencies
|
||||
```
|
||||
|
||||
### Section Templates
|
||||
```
|
||||
SectionTemplates/
|
||||
└── st_text_image_module/
|
||||
├── StoreElement.xml # Template metadata
|
||||
├── GomSource.xml # Form definition
|
||||
├── Ruleset.xml # Form rules
|
||||
├── ChannelSource_HTML_html.html # HTML output
|
||||
├── SnippetThumb.txt # Thumbnail preview
|
||||
├── SnippetHeader.txt # Header preview
|
||||
├── SnippetExtract.txt # Extract preview
|
||||
├── FS_Files.txt # File registry
|
||||
├── FS_Info.txt # Metadata
|
||||
└── FS_References.txt # Dependencies
|
||||
```
|
||||
|
||||
### Format Templates
|
||||
```
|
||||
FormatTemplates/
|
||||
├── h1/
|
||||
│ ├── StoreElement.xml # Format definition with style
|
||||
│ ├── ChannelSource_HTML_html.html # HTML rendering
|
||||
│ ├── FS_Files.txt
|
||||
│ ├── FS_Info.txt
|
||||
│ └── FS_References.txt
|
||||
│
|
||||
└── common_format_templates/ # Folder grouping
|
||||
├── StoreElement.xml # Folder metadata
|
||||
├── FS_Files.txt
|
||||
├── FS_Info.txt
|
||||
├── FS_References.txt
|
||||
│
|
||||
├── default_style_template/
|
||||
│ ├── StoreElement.xml # Style template definition
|
||||
│ ├── GomSource.xml # Style configuration form
|
||||
│ ├── GomDefaults.xml # Default style values
|
||||
│ ├── Ruleset.xml
|
||||
│ ├── ChannelSource_HTML_html.html
|
||||
│ ├── FS_Files.txt
|
||||
│ ├── FS_Info.txt
|
||||
│ └── FS_References.txt
|
||||
│
|
||||
└── p/ # Paragraph format
|
||||
├── StoreElement.xml
|
||||
├── ChannelSource_HTML_html.html
|
||||
└── ...
|
||||
```
|
||||
|
||||
### Workflows
|
||||
```
|
||||
Workflows/
|
||||
└── assign_task/
|
||||
├── StoreElement.xml # Workflow metadata
|
||||
├── Workflow.xml # Workflow definition (states, transitions)
|
||||
├── GomSource.xml # Form for workflow parameters
|
||||
├── Ruleset.xml # Form rules
|
||||
├── ViewScript.txt # Custom view script (optional)
|
||||
├── SnippetThumb.txt # Preview files
|
||||
├── SnippetHeader.txt
|
||||
├── SnippetExtract.txt
|
||||
├── FS_Files.txt
|
||||
├── FS_Info.txt
|
||||
└── FS_References.txt
|
||||
```
|
||||
|
||||
## Metadata Directory: .FirstSpirit
|
||||
|
||||
**Location**: `.FirstSpirit/` at the root of the sync directory
|
||||
|
||||
**Purpose**: Contains internal metadata required for successful synchronization between file system and FirstSpirit server
|
||||
|
||||
**Important**: Do NOT version control this directory. It contains session-specific information.
|
||||
|
||||
### Files
|
||||
|
||||
#### Files_[sessionid]_[revision].txt
|
||||
**Purpose**: Complete file registry for the export
|
||||
|
||||
**Contains**: Tab-delimited entries with reference IDs and file information (checksum, size, timestamp, MIME type, filename)
|
||||
|
||||
#### Import_[sessionid]_[revision].txt
|
||||
**Purpose**: Import instructions and metadata for re-importing into FirstSpirit
|
||||
|
||||
## Template Identification
|
||||
|
||||
### Finding Templates
|
||||
|
||||
Templates are located by type in their respective directories:
|
||||
|
||||
| What to find | Where to look | Identifier |
|
||||
|-------------|---------------|------------|
|
||||
| Page template by name | `PageTemplates/[name]/` | Directory name matches template reference name |
|
||||
| Section template by name | `SectionTemplates/[name]/` | Directory name matches template reference name |
|
||||
| Format template by name | `FormatTemplates/[name]/` | Directory name matches format name |
|
||||
| Template by ID | Search `StoreElement.xml` files for `id` attribute | Unique numeric ID |
|
||||
| Template display name | Look in `StoreElement.xml` → `<LANG>` elements | Multilingual display names |
|
||||
|
||||
### Template Reference Names
|
||||
|
||||
The directory name matches the template's **reference name** (UID name) in FirstSpirit:
|
||||
- `pt_standard_page` → Page Template with reference name "pt_standard_page"
|
||||
- `st_text_image_module` → Section Template with reference name "st_text_image_module"
|
||||
|
||||
### Template IDs
|
||||
|
||||
Each template has two IDs in `StoreElement.xml`:
|
||||
- `id` - Element instance ID
|
||||
- `templateid` - Template definition ID (for page/section templates)
|
||||
|
||||
## Information Access Guide
|
||||
|
||||
### How to Find Specific Information
|
||||
|
||||
| Information Needed | File to Check | Location in File |
|
||||
|-------------------|---------------|------------------|
|
||||
| **Template display name** | `StoreElement.xml` | `<LANG displayname="..." language="EN"/>` |
|
||||
| **Template reference name** | `StoreElement.xml` | `filename` or `name` attribute |
|
||||
| **Template ID** | `StoreElement.xml` | `id` attribute |
|
||||
| **Form fields** | `GomSource.xml` | `<CMS_INPUT_*>` elements |
|
||||
| **Field labels** | `GomSource.xml` | `<LANGINFO lang="*" label="..."/>` |
|
||||
| **Available format templates** | `GomSource.xml` in DOM fields | `<FORMATS><TEMPLATE name="..."/></FORMATS>` |
|
||||
| **HTML output** | `ChannelSource_HTML_html.html` | Entire file |
|
||||
| **Template variables** | `ChannelSource_HTML_html.html` | `<CMS_HEADER>` section |
|
||||
| **Form rules** | `Ruleset.xml` | `<RULE>` elements |
|
||||
| **Dependencies** | `FS_References.txt` | List of referenced elements |
|
||||
| **Workflow states** | `Workflow.xml` | `<FIELD name="states">` section |
|
||||
| **Workflow transitions** | `Workflow.xml` | `<FIELD name="transitions">` section |
|
||||
|
||||
## Template Set Configuration
|
||||
|
||||
**Location**: `StoreElement.xml` → `<EXTENSION>` element
|
||||
|
||||
**Attributes**:
|
||||
- `file` - File extension for generated files
|
||||
- `link` - Link extension
|
||||
- `templateSet` - Template set ID
|
||||
- `replaceable` - Whether extension can be changed
|
||||
|
||||
## Common Use Cases
|
||||
|
||||
### 1. Finding All Section Templates
|
||||
```bash
|
||||
find sync_dir/TemplateStore/SectionTemplates -name "StoreElement.xml" -type f
|
||||
```
|
||||
|
||||
### 2. Extracting Template Display Names
|
||||
```bash
|
||||
grep -r "displayname=" sync_dir/TemplateStore/*/*/StoreElement.xml
|
||||
```
|
||||
|
||||
### 3. Finding Templates Using a Specific Format
|
||||
```bash
|
||||
grep -r '<TEMPLATE name="h1"/>' sync_dir/TemplateStore/*/*/GomSource.xml
|
||||
```
|
||||
|
||||
### 4. Listing All Form Fields in a Template
|
||||
```bash
|
||||
grep -o 'name="[^"]*"' sync_dir/TemplateStore/PageTemplates/pt_standard_page/GomSource.xml
|
||||
```
|
||||
|
||||
### 5. Finding All HTML Output Templates
|
||||
```bash
|
||||
find sync_dir/TemplateStore -name "ChannelSource_HTML_html.html" -type f
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Version Control
|
||||
1. **DO** version control all template files in `TemplateStore/`
|
||||
2. **DO NOT** version control `.FirstSpirit/` directory
|
||||
3. **DO** commit `StoreElement.xml`, `GomSource.xml`, `ChannelSource_*`, and `Ruleset.xml` files
|
||||
4. **CONSIDER** whether to version `FS_Files.txt` (contains checksums that change frequently)
|
||||
|
||||
### Template Development
|
||||
1. **Naming**: Use consistent prefixes (e.g., `pt_` for page templates, `st_` for section templates)
|
||||
2. **Organization**: Group related format templates in folders (like `common_format_templates/`)
|
||||
3. **Documentation**: Use meaningful `displayname` attributes in multilingual `<LANG>` elements
|
||||
4. **Dependencies**: Check `FS_References.txt` to understand template dependencies
|
||||
|
||||
### Editing Exported Files
|
||||
1. **StoreElement.xml**: Edit carefully, preserve IDs unless creating new templates
|
||||
2. **GomSource.xml**: Standard XML, can be edited directly
|
||||
3. **ChannelSource files**: Edit freely, contains your template output logic
|
||||
4. **Ruleset.xml**: Edit rules following FirstSpirit rule syntax
|
||||
5. **Workflow.xml**: Complex Java serialization format, prefer editing in SiteArchitect
|
||||
|
||||
### Re-importing
|
||||
1. Maintain the exact directory structure
|
||||
2. Keep `StoreElement.xml` IDs consistent for updates
|
||||
3. Ensure all referenced templates exist
|
||||
4. Validate XML syntax before import
|
||||
|
||||
## File Type Summary Table
|
||||
|
||||
| File | Required | Template Types | Editable | Purpose |
|
||||
|------|----------|----------------|----------|---------|
|
||||
| `StoreElement.xml` | Yes | All | Yes (carefully) | Template metadata and configuration |
|
||||
| `GomSource.xml` | For templates with forms | Page, Section, Workflow, Style | Yes | Form definition (input components) |
|
||||
| `GomDefaults.xml` | No | Style/Format | Yes | Default form values |
|
||||
| `Ruleset.xml` | No | Page, Section, Workflow | Yes | Dynamic form rules |
|
||||
| `ChannelSource_*.html` | For output templates | Page, Section, Format | Yes | Output channel templates |
|
||||
| `Workflow.xml` | Yes | Workflow | No (use SiteArchitect) | Workflow definition |
|
||||
| `ViewScript.txt` | No | Workflow | Yes | Custom workflow view |
|
||||
| `Snippet*.txt` | No | Page, Section | Yes | Preview content |
|
||||
| `FS_Files.txt` | Yes | All | No (auto-generated) | File registry |
|
||||
| `FS_Info.txt` | Yes | All | No (auto-generated) | Element metadata |
|
||||
| `FS_References.txt` | Yes | All | No (auto-generated) | Dependency tracking |
|
||||
|
||||
## References
|
||||
|
||||
- **Official Documentation**: https://docs.e-spirit.com/odfs/edocs/sync/
|
||||
- **FS-CLI Tool**: https://github.com/e-Spirit/FSDevTools
|
||||
- **Template Development**: https://docs.e-spirit.com/odfs/template-develo/
|
||||
- **External Synchronization**: https://docs.e-spirit.com/odfs/edocs/sync/how/4-export/
|
||||
152
skills/firstspirit-fs-cli/reference/fs-cli-usage.md
Normal file
152
skills/firstspirit-fs-cli/reference/fs-cli-usage.md
Normal file
@@ -0,0 +1,152 @@
|
||||
# FS-CLI Usage Guide
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Java Runtime Environment (JRE) 17 or higher
|
||||
- FirstSpirit 5.2.231105 or higher
|
||||
- Correct `JAVA_HOME` environment variable set
|
||||
|
||||
## Environment Variables
|
||||
|
||||
FS-CLI supports environment variables to simplify command execution:
|
||||
|
||||
| Variable | Description | Default |
|
||||
|-------------|------------------------------------------------|-------------|
|
||||
| `fshost` | FirstSpirit host address | `localhost` |
|
||||
| `fsport` | FirstSpirit port number | `8000` |
|
||||
| `fsmode` | Connection mode: HTTP, HTTPS, or SOCKET | `HTTP` |
|
||||
| `fsuser` | FirstSpirit user account | - |
|
||||
| `fspwd` | FirstSpirit user password | - |
|
||||
| `fsproject` | FirstSpirit project name | - |
|
||||
|
||||
**IMPORTANT:** These environment variables are already set in the .env file in the project root directory for convenience.
|
||||
|
||||
### Setup Environment Variables
|
||||
|
||||
The `.env` file should use standard format (without `export` keyword). Use `set -a; source .env; set +a` before running fs-cli commands to properly export these variables.
|
||||
|
||||
|
||||
## Common Commands
|
||||
|
||||
### Test Connection
|
||||
Test connection to FirstSpirit server:
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh test
|
||||
```
|
||||
|
||||
### Export Templates
|
||||
|
||||
Export only templates (no content, media, etc.):
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export -- templatestore
|
||||
```
|
||||
|
||||
### Export Single Template by ID
|
||||
|
||||
Export a specific template by its UID:
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export -- sectiontemplate:st_text_image_module
|
||||
```
|
||||
|
||||
**Template Type Prefixes:**
|
||||
- `sectiontemplate:` - Section templates
|
||||
- `pagetemplate:` - Page templates
|
||||
- `formattemplate:` - Format templates
|
||||
- `linktemplate:` - Link templates
|
||||
- `workflow:` - Workflows
|
||||
- `script:` - Scripts
|
||||
|
||||
**Examples:**
|
||||
```bash
|
||||
# Export a section template
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export -- sectiontemplate:st_text_image_module
|
||||
|
||||
# Export a page template
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export -- pagetemplate:pt_standard_page
|
||||
|
||||
# Export multiple specific templates
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export -- sectiontemplate:st_text_image_module pagetemplate:pt_standard_page
|
||||
```
|
||||
|
||||
**What Happens to Previously Exported Templates:**
|
||||
|
||||
When you export a specific template by ID, fs-cli will **remove all other templates** from `sync_dir/` that are not part of the current export. This keeps the sync directory focused on only the templates you specified.
|
||||
|
||||
- **Before**: `sync_dir/` contains all previously exported templates
|
||||
- **After**: `sync_dir/` contains **only** the template(s) you just exported
|
||||
- **Deleted**: All other templates are removed from `sync_dir/` (not from the server!)
|
||||
|
||||
**To keep existing templates and add more**, use the `--keepObsoleteFiles` flag:
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export --keepObsoleteFiles -- sectiontemplate:st_text_image_module
|
||||
```
|
||||
|
||||
### Export Specific Element by UID
|
||||
|
||||
Export a single element by its unique ID:
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ export -uid homepage
|
||||
```
|
||||
|
||||
Replace `homepage` with the UID of the element you want to export.
|
||||
|
||||
### Import Templates
|
||||
|
||||
Import templates from local sync directory to FirstSpirit server:
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ import
|
||||
```
|
||||
|
||||
**Requirements:**
|
||||
- Sync directory must exist
|
||||
- Sync directory must contain valid `TemplateStore/` structure (see `fs-cli-sync-structure.md`)
|
||||
- User must have write permissions in FirstSpirit project
|
||||
|
||||
**Important:** Import overwrites existing templates with the same names in FirstSpirit.
|
||||
|
||||
### Dry Run Import
|
||||
|
||||
Test import without making changes to the server:
|
||||
|
||||
```bash
|
||||
set -a && source .env && set +a && .fs-cli/bin/fs-cli.sh -sd sync_dir/ import --dry-run
|
||||
```
|
||||
|
||||
Use this to verify what would be imported before actually doing it.
|
||||
|
||||
## Alternative: Using Explicit Parameters
|
||||
|
||||
If you prefer not to use environment variables, you can specify all parameters explicitly:
|
||||
|
||||
```bash
|
||||
.fs-cli/bin/fs-cli.sh \
|
||||
-h localhost \
|
||||
-port 8000 \
|
||||
-u admin \
|
||||
-pwd your-password \
|
||||
-m HTTP \
|
||||
-p my-project \
|
||||
-sd sync_dir/ \
|
||||
export
|
||||
```
|
||||
|
||||
**However**, using environment variables (via `.env` file) is **strongly recommended** for:
|
||||
- Security (credentials not in command history)
|
||||
- Convenience (shorter commands)
|
||||
- Consistency (same config across commands)
|
||||
|
||||
## Notes
|
||||
|
||||
- **Always use `set -a && source .env && set +a` before running commands** to properly export environment variables
|
||||
- When using environment variables, connection parameters (`-h`, `-port`, `-u`, `-pwd`, `-m`, `-p`) can be omitted
|
||||
- The sync directory is in the project root subfolder `sync_dir/`
|
||||
- Global options like `-sd` must come BEFORE the command (e.g., `-sd sync_dir/ export` not `export -sd sync_dir/`)
|
||||
- Import overwrites existing templates with the same names in FirstSpirit
|
||||
- Export creates/overwrites files in the sync directory
|
||||
- Use `--dry-run` with import to test safely before applying changes
|
||||
196
skills/firstspirit-fs-cli/scripts/setup-fs-cli.sh
Executable file
196
skills/firstspirit-fs-cli/scripts/setup-fs-cli.sh
Executable file
@@ -0,0 +1,196 @@
|
||||
#!/bin/bash
|
||||
# Setup script for fs-cli in FirstSpirit projects
|
||||
# This script downloads and extracts fs-cli to .fs-cli/ directory
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(pwd)"
|
||||
FS_CLI_DIR="$PROJECT_ROOT/.fs-cli"
|
||||
DEFAULT_FS_CLI_VERSION="4.8.6"
|
||||
|
||||
echo "========================================="
|
||||
echo "FirstSpirit CLI Setup"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
||||
# Step 1: Prompt for fs-cli version
|
||||
read -p "Enter fs-cli version to download [$DEFAULT_FS_CLI_VERSION]: " FS_CLI_VERSION
|
||||
FS_CLI_VERSION=${FS_CLI_VERSION:-$DEFAULT_FS_CLI_VERSION}
|
||||
|
||||
# Step 2: Create .fs-cli directory
|
||||
echo ""
|
||||
echo "Creating .fs-cli directory..."
|
||||
mkdir -p "$FS_CLI_DIR"
|
||||
|
||||
# Step 3: Download fs-cli
|
||||
DOWNLOAD_URL="https://github.com/e-Spirit/FSDevTools/releases/download/${FS_CLI_VERSION}/fs-cli-${FS_CLI_VERSION}.tar.gz"
|
||||
TARBALL="$FS_CLI_DIR/fs-cli-${FS_CLI_VERSION}.tar.gz"
|
||||
|
||||
echo "Downloading fs-cli ${FS_CLI_VERSION}..."
|
||||
echo "URL: $DOWNLOAD_URL"
|
||||
|
||||
if command -v curl &> /dev/null; then
|
||||
curl -L -o "$TARBALL" "$DOWNLOAD_URL"
|
||||
elif command -v wget &> /dev/null; then
|
||||
wget -O "$TARBALL" "$DOWNLOAD_URL"
|
||||
else
|
||||
echo "Error: Neither curl nor wget found. Please install one of them."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Step 4: Extract and flatten directory structure
|
||||
echo "Extracting fs-cli..."
|
||||
tar -xzf "$TARBALL" -C "$FS_CLI_DIR"
|
||||
# Move contents from fs-cli-VERSION/ to .fs-cli/ directly
|
||||
mv "$FS_CLI_DIR/fs-cli-${FS_CLI_VERSION}"/* "$FS_CLI_DIR/"
|
||||
mv "$FS_CLI_DIR/fs-cli-${FS_CLI_VERSION}"/.[!.]* "$FS_CLI_DIR/" 2>/dev/null || true
|
||||
rmdir "$FS_CLI_DIR/fs-cli-${FS_CLI_VERSION}"
|
||||
rm "$TARBALL"
|
||||
|
||||
echo ""
|
||||
echo "✓ fs-cli ${FS_CLI_VERSION} downloaded and extracted"
|
||||
echo ""
|
||||
|
||||
# Step 5: Prompt for FirstSpirit version
|
||||
read -p "Enter your FirstSpirit server version (e.g., 2025.01, 2024.09): " FS_VERSION
|
||||
|
||||
# Step 6: Instructions for fs-isolated-runtime.jar
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "IMPORTANT: Manual Step Required"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "You need to obtain fs-isolated-runtime.jar for FirstSpirit ${FS_VERSION}"
|
||||
echo ""
|
||||
echo "Option 1: From your FirstSpirit server"
|
||||
echo " 1. SSH into your FirstSpirit server"
|
||||
echo " 2. Navigate to: <FS_INSTALL>/server/lib-isolated/"
|
||||
echo " 3. Copy fs-isolated-runtime.jar to:"
|
||||
echo " $FS_CLI_DIR/lib/fs-isolated-runtime.jar"
|
||||
echo ""
|
||||
echo "Option 2: From FirstSpirit developer portal"
|
||||
echo " 1. Login to e-Spirit developer portal"
|
||||
echo " 2. Download fs-isolated-runtime.jar for version ${FS_VERSION}"
|
||||
echo " 3. Copy it to:"
|
||||
echo " $FS_CLI_DIR/lib/fs-isolated-runtime.jar"
|
||||
echo ""
|
||||
echo "Press Enter when you have placed fs-isolated-runtime.jar in the lib folder..."
|
||||
read
|
||||
|
||||
# Step 7: Validate jar exists
|
||||
JAR_PATH="$FS_CLI_DIR/lib/fs-isolated-runtime.jar"
|
||||
if [ ! -f "$JAR_PATH" ]; then
|
||||
echo ""
|
||||
echo "⚠ Warning: fs-isolated-runtime.jar not found at:"
|
||||
echo " $JAR_PATH"
|
||||
echo ""
|
||||
echo "Please place the file there before running fs-cli commands."
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
echo "✓ fs-isolated-runtime.jar found"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Step 8: Create .env file
|
||||
ENV_FILE="$PROJECT_ROOT/.env"
|
||||
ENV_EXAMPLE="$PROJECT_ROOT/.env.example"
|
||||
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
echo "Creating .env file for configuration..."
|
||||
echo ""
|
||||
|
||||
read -p "FirstSpirit server host [localhost]: " FS_HOST
|
||||
FS_HOST=${FS_HOST:-localhost}
|
||||
|
||||
read -p "FirstSpirit server port [8000]: " FS_PORT
|
||||
FS_PORT=${FS_PORT:-8000}
|
||||
|
||||
read -p "Connection mode (HTTP/HTTPS/SOCKET) [HTTP]: " FS_MODE
|
||||
FS_MODE=${FS_MODE:-HTTP}
|
||||
|
||||
read -p "FirstSpirit project name: " FS_PROJECT
|
||||
|
||||
read -p "FirstSpirit username: " FS_USER
|
||||
|
||||
read -s -p "FirstSpirit password: " FS_PASSWORD
|
||||
echo ""
|
||||
|
||||
cat > "$ENV_FILE" << EOF
|
||||
# FirstSpirit Server Configuration
|
||||
fshost=${FS_HOST}
|
||||
fsport=${FS_PORT}
|
||||
fsmode=${FS_MODE}
|
||||
fsproject=${FS_PROJECT}
|
||||
|
||||
# FirstSpirit Credentials (KEEP SECRET - DO NOT COMMIT)
|
||||
fsuser=${FS_USER}
|
||||
fspwd=${FS_PASSWORD}
|
||||
|
||||
# fs-cli Configuration (for reference only, not used by fs-cli)
|
||||
FS_CLI_VERSION=${FS_CLI_VERSION}
|
||||
FS_VERSION=${FS_VERSION}
|
||||
EOF
|
||||
|
||||
# Create .env.example (without secrets)
|
||||
cat > "$ENV_EXAMPLE" << EOF
|
||||
# FirstSpirit Server Configuration
|
||||
fshost=localhost
|
||||
fsport=8000
|
||||
fsmode=HTTP
|
||||
fsproject=your-project-name
|
||||
|
||||
# FirstSpirit Credentials (KEEP SECRET - DO NOT COMMIT)
|
||||
fsuser=your-username
|
||||
fspwd=your-password
|
||||
|
||||
# fs-cli Configuration (for reference only, not used by fs-cli)
|
||||
FS_CLI_VERSION=${FS_CLI_VERSION}
|
||||
FS_VERSION=${FS_VERSION}
|
||||
EOF
|
||||
|
||||
echo ""
|
||||
echo "✓ Created .env and .env.example files"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Step 9: Update .gitignore
|
||||
GITIGNORE="$PROJECT_ROOT/.gitignore"
|
||||
if [ -f "$GITIGNORE" ]; then
|
||||
if ! grep -q "^\.fs-cli/" "$GITIGNORE"; then
|
||||
echo "" >> "$GITIGNORE"
|
||||
echo "# FirstSpirit CLI" >> "$GITIGNORE"
|
||||
echo ".fs-cli/" >> "$GITIGNORE"
|
||||
echo ".env" >> "$GITIGNORE"
|
||||
echo "" >> "$GITIGNORE"
|
||||
echo "✓ Updated .gitignore"
|
||||
else
|
||||
echo "✓ .gitignore already configured"
|
||||
fi
|
||||
else
|
||||
cat > "$GITIGNORE" << EOF
|
||||
# FirstSpirit CLI
|
||||
.fs-cli/
|
||||
.env
|
||||
EOF
|
||||
echo "✓ Created .gitignore"
|
||||
fi
|
||||
|
||||
# Step 10: Mark setup complete
|
||||
echo "$FS_CLI_VERSION" > "$FS_CLI_DIR/.setup-marker"
|
||||
echo "$FS_VERSION" >> "$FS_CLI_DIR/.setup-marker"
|
||||
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Setup Complete!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Verify fs-isolated-runtime.jar is in place"
|
||||
echo " 2. Test connection: bash validate-environment.sh"
|
||||
echo " 3. Start using fs-cli via the FirstSpirit skill"
|
||||
echo ""
|
||||
echo "Configuration stored in: .env"
|
||||
echo "fs-cli installed at: $FS_CLI_DIR/"
|
||||
echo "fs-cli version: ${FS_CLI_VERSION}"
|
||||
echo ""
|
||||
98
skills/firstspirit-fs-cli/scripts/validate-environment.sh
Executable file
98
skills/firstspirit-fs-cli/scripts/validate-environment.sh
Executable file
@@ -0,0 +1,98 @@
|
||||
#!/bin/bash
|
||||
# Validates Java environment and fs-cli setup
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_ROOT="$(pwd)"
|
||||
FS_CLI_DIR="$PROJECT_ROOT/.fs-cli"
|
||||
|
||||
echo "Validating FirstSpirit CLI environment..."
|
||||
echo ""
|
||||
|
||||
# Load .env
|
||||
if [ -f "$PROJECT_ROOT/.env" ]; then
|
||||
source "$PROJECT_ROOT/.env"
|
||||
else
|
||||
echo "❌ .env file not found. Run setup-fs-cli.sh first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check Java
|
||||
echo "Checking Java..."
|
||||
if ! command -v java &> /dev/null; then
|
||||
echo "❌ Java not found. Please install Java 17 or higher."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{print $1}')
|
||||
if [ "$JAVA_VERSION" -lt 17 ]; then
|
||||
echo "❌ Java 17+ required. Found Java $JAVA_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Java $JAVA_VERSION found"
|
||||
|
||||
# Check JAVA_HOME
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
echo "⚠ Warning: JAVA_HOME not set"
|
||||
echo " Consider setting it in your shell profile"
|
||||
else
|
||||
echo "✓ JAVA_HOME: $JAVA_HOME"
|
||||
fi
|
||||
|
||||
# Check fs-cli directory
|
||||
if [ ! -d "$FS_CLI_DIR" ]; then
|
||||
echo "❌ .fs-cli directory not found. Run setup-fs-cli.sh first."
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ .fs-cli directory exists"
|
||||
|
||||
# Check fs-cli installation
|
||||
FS_CLI_VERSION=${FS_CLI_VERSION:-"4.8.6"}
|
||||
if [ ! -d "$FS_CLI_DIR/bin" ] || [ ! -d "$FS_CLI_DIR/lib" ]; then
|
||||
echo "❌ fs-cli not properly installed at: $FS_CLI_DIR"
|
||||
echo " Expected bin/ and lib/ directories not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ fs-cli $FS_CLI_VERSION installed"
|
||||
|
||||
# Check fs-isolated-runtime.jar
|
||||
JAR_PATH="$FS_CLI_DIR/lib/fs-isolated-runtime.jar"
|
||||
if [ ! -f "$JAR_PATH" ]; then
|
||||
echo "❌ fs-isolated-runtime.jar not found at: $JAR_PATH"
|
||||
echo " Please obtain it from your FirstSpirit server or developer portal"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ fs-isolated-runtime.jar found"
|
||||
|
||||
# Check fs-cli executable
|
||||
FS_CLI_BIN="$FS_CLI_DIR/bin/fs-cli"
|
||||
if [ ! -x "$FS_CLI_BIN" ]; then
|
||||
chmod +x "$FS_CLI_BIN"
|
||||
fi
|
||||
echo "✓ fs-cli executable ready"
|
||||
|
||||
# Test fs-cli help
|
||||
echo ""
|
||||
echo "Testing fs-cli..."
|
||||
if "$FS_CLI_BIN" -h > /dev/null 2>&1; then
|
||||
echo "✓ fs-cli runs successfully"
|
||||
else
|
||||
echo "❌ fs-cli failed to run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Display configuration
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Environment Valid!"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "Configuration:"
|
||||
echo " Server: $fsmode://$fshost:$fsport"
|
||||
echo " Project: $fsproject"
|
||||
echo " User: $fsuser"
|
||||
echo " fs-cli: $FS_CLI_VERSION"
|
||||
echo " FS Version: $FS_VERSION"
|
||||
echo ""
|
||||
echo "Ready to use fs-cli!"
|
||||
echo ""
|
||||
13
skills/firstspirit-fs-cli/templates/.env.example.template
Normal file
13
skills/firstspirit-fs-cli/templates/.env.example.template
Normal file
@@ -0,0 +1,13 @@
|
||||
# FirstSpirit Server Configuration
|
||||
FS_HOST=localhost
|
||||
FS_PORT=8000
|
||||
FS_MODE=HTTP
|
||||
FS_PROJECT=your-project-name
|
||||
|
||||
# FirstSpirit Credentials (KEEP SECRET - DO NOT COMMIT)
|
||||
FS_USER=your-username
|
||||
FS_PASSWORD=your-password
|
||||
|
||||
# fs-cli Configuration
|
||||
FS_CLI_VERSION=4.8.6
|
||||
FS_VERSION=2025.01
|
||||
13
skills/firstspirit-fs-cli/templates/.env.template
Normal file
13
skills/firstspirit-fs-cli/templates/.env.template
Normal file
@@ -0,0 +1,13 @@
|
||||
# FirstSpirit Server Configuration
|
||||
FS_HOST=localhost
|
||||
FS_PORT=8000
|
||||
FS_MODE=HTTP
|
||||
FS_PROJECT=your-project-name
|
||||
|
||||
# FirstSpirit Credentials (KEEP SECRET - DO NOT COMMIT)
|
||||
FS_USER=your-username
|
||||
FS_PASSWORD=your-password
|
||||
|
||||
# fs-cli Configuration
|
||||
FS_CLI_VERSION=4.8.6
|
||||
FS_VERSION=2025.01
|
||||
3
skills/firstspirit-fs-cli/templates/.gitignore.fs-cli
Normal file
3
skills/firstspirit-fs-cli/templates/.gitignore.fs-cli
Normal file
@@ -0,0 +1,3 @@
|
||||
# FirstSpirit CLI
|
||||
.fs-cli/
|
||||
.env
|
||||
Reference in New Issue
Block a user