jfl 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +77 -7
  2. package/clawdbot-plugin/clawdbot.plugin.json +20 -0
  3. package/clawdbot-plugin/index.js +555 -0
  4. package/clawdbot-plugin/index.ts +582 -0
  5. package/clawdbot-skill/SKILL.md +33 -336
  6. package/clawdbot-skill/index.ts +491 -321
  7. package/clawdbot-skill/skill.json +4 -13
  8. package/dist/commands/clawdbot.d.ts +11 -0
  9. package/dist/commands/clawdbot.d.ts.map +1 -0
  10. package/dist/commands/clawdbot.js +215 -0
  11. package/dist/commands/clawdbot.js.map +1 -0
  12. package/dist/commands/gtm-process-update.d.ts +10 -0
  13. package/dist/commands/gtm-process-update.d.ts.map +1 -0
  14. package/dist/commands/gtm-process-update.js +101 -0
  15. package/dist/commands/gtm-process-update.js.map +1 -0
  16. package/dist/commands/onboard.d.ts.map +1 -1
  17. package/dist/commands/onboard.js +203 -15
  18. package/dist/commands/onboard.js.map +1 -1
  19. package/dist/commands/openclaw.d.ts +56 -0
  20. package/dist/commands/openclaw.d.ts.map +1 -0
  21. package/dist/commands/openclaw.js +700 -0
  22. package/dist/commands/openclaw.js.map +1 -0
  23. package/dist/commands/service-validate.d.ts +12 -0
  24. package/dist/commands/service-validate.d.ts.map +1 -0
  25. package/dist/commands/service-validate.js +611 -0
  26. package/dist/commands/service-validate.js.map +1 -0
  27. package/dist/commands/services-create.d.ts +15 -0
  28. package/dist/commands/services-create.d.ts.map +1 -0
  29. package/dist/commands/services-create.js +1452 -0
  30. package/dist/commands/services-create.js.map +1 -0
  31. package/dist/commands/services-sync-agents.d.ts +23 -0
  32. package/dist/commands/services-sync-agents.d.ts.map +1 -0
  33. package/dist/commands/services-sync-agents.js +207 -0
  34. package/dist/commands/services-sync-agents.js.map +1 -0
  35. package/dist/commands/services.d.ts +7 -1
  36. package/dist/commands/services.d.ts.map +1 -1
  37. package/dist/commands/services.js +347 -22
  38. package/dist/commands/services.js.map +1 -1
  39. package/dist/commands/update.js +0 -0
  40. package/dist/commands/validate-settings.d.ts +37 -0
  41. package/dist/commands/validate-settings.d.ts.map +1 -0
  42. package/dist/commands/validate-settings.js +197 -0
  43. package/dist/commands/validate-settings.js.map +1 -0
  44. package/dist/index.js +155 -60
  45. package/dist/index.js.map +1 -1
  46. package/dist/lib/agent-generator.d.ts.map +1 -1
  47. package/dist/lib/agent-generator.js +94 -1
  48. package/dist/lib/agent-generator.js.map +1 -1
  49. package/dist/lib/openclaw-registry.d.ts +48 -0
  50. package/dist/lib/openclaw-registry.d.ts.map +1 -0
  51. package/dist/lib/openclaw-registry.js +181 -0
  52. package/dist/lib/openclaw-registry.js.map +1 -0
  53. package/dist/lib/openclaw-sdk.d.ts +107 -0
  54. package/dist/lib/openclaw-sdk.d.ts.map +1 -0
  55. package/dist/lib/openclaw-sdk.js +208 -0
  56. package/dist/lib/openclaw-sdk.js.map +1 -0
  57. package/dist/lib/peer-agent-generator.d.ts +44 -0
  58. package/dist/lib/peer-agent-generator.d.ts.map +1 -0
  59. package/dist/lib/peer-agent-generator.js +286 -0
  60. package/dist/lib/peer-agent-generator.js.map +1 -0
  61. package/dist/lib/service-detector.d.ts +1 -1
  62. package/dist/lib/service-detector.d.ts.map +1 -1
  63. package/dist/lib/service-detector.js +118 -5
  64. package/dist/lib/service-detector.js.map +1 -1
  65. package/dist/lib/service-gtm.d.ts +157 -0
  66. package/dist/lib/service-gtm.d.ts.map +1 -0
  67. package/dist/lib/service-gtm.js +786 -0
  68. package/dist/lib/service-gtm.js.map +1 -0
  69. package/dist/lib/service-mcp-base.d.ts +10 -1
  70. package/dist/lib/service-mcp-base.d.ts.map +1 -1
  71. package/dist/lib/service-mcp-base.js +20 -1
  72. package/dist/lib/service-mcp-base.js.map +1 -1
  73. package/dist/mcp/service-peer-mcp.d.ts +36 -0
  74. package/dist/mcp/service-peer-mcp.d.ts.map +1 -0
  75. package/dist/mcp/service-peer-mcp.js +220 -0
  76. package/dist/mcp/service-peer-mcp.js.map +1 -0
  77. package/dist/mcp/service-registry-mcp.js +0 -0
  78. package/dist/utils/settings-validator.d.ts +4 -1
  79. package/dist/utils/settings-validator.d.ts.map +1 -1
  80. package/dist/utils/settings-validator.js +25 -1
  81. package/dist/utils/settings-validator.js.map +1 -1
  82. package/package.json +2 -1
  83. package/template/.claude/service-settings.json +32 -0
  84. package/template/.claude/settings.json +10 -0
  85. package/template/.claude/skills/end/SKILL.md +1780 -0
  86. package/template/.jfl/config.json +2 -1
  87. package/template/.mcp.json +1 -7
  88. package/template/CLAUDE.md +1042 -248
  89. package/template/CLAUDE.md.bak +1187 -0
  90. package/template/scripts/commit-gtm.sh +56 -0
  91. package/template/scripts/commit-product.sh +68 -0
  92. package/template/scripts/migrate-to-branch-sessions.sh +201 -0
  93. package/template/scripts/session/auto-commit.sh +4 -3
  94. package/template/scripts/session/jfl-doctor.sh +222 -83
  95. package/template/scripts/session/session-cleanup.sh +109 -21
  96. package/template/scripts/session/session-end.sh +26 -13
  97. package/template/scripts/session/session-init.sh +280 -98
  98. package/template/scripts/session/test-critical-infrastructure.sh +293 -0
  99. package/template/scripts/session/test-experience-level.sh +336 -0
  100. package/template/scripts/session/test-session-cleanup.sh +268 -0
  101. package/template/scripts/session/test-session-sync.sh +320 -0
  102. package/template/scripts/where-am-i.sh +78 -0
  103. package/template/templates/service-agent/.claude/settings.json +32 -0
  104. package/template/templates/service-agent/CLAUDE.md +334 -0
  105. package/template/templates/service-agent/knowledge/ARCHITECTURE.md +115 -0
  106. package/template/templates/service-agent/knowledge/DEPLOYMENT.md +199 -0
  107. package/template/templates/service-agent/knowledge/RUNBOOK.md +412 -0
  108. package/template/templates/service-agent/knowledge/SERVICE_SPEC.md +77 -0
  109. package/dist/commands/session-mgmt.d.ts +0 -33
  110. package/dist/commands/session-mgmt.d.ts.map +0 -1
  111. package/dist/commands/session-mgmt.js +0 -404
  112. package/dist/commands/session-mgmt.js.map +0 -1
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # commit-gtm.sh - Commit changes to GTM repo (knowledge, content, etc.)
4
+ #
5
+ # Usage:
6
+ # ./scripts/commit-gtm.sh "commit message"
7
+ #
8
+ # This commits to the GTM repo (not the product submodule):
9
+ # - knowledge/
10
+ # - content/
11
+ # - suggestions/
12
+ # - previews/
13
+ # - etc.
14
+
15
+ set -e
16
+
17
+ if [[ -z "$1" ]]; then
18
+ echo "Usage: $0 \"commit message\""
19
+ exit 1
20
+ fi
21
+
22
+ COMMIT_MSG="$1"
23
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24
+ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
25
+
26
+ echo "📝 Committing to GTM repo..."
27
+ echo ""
28
+
29
+ cd "$REPO_ROOT"
30
+
31
+ # Show what will be committed (exclude all submodules)
32
+ echo "Changes to commit:"
33
+ git status --short | grep -v "^M. product" | grep -v "^M. runner" || true
34
+ echo ""
35
+
36
+ # Stage all changes except submodules (product, runner, etc.)
37
+ git add knowledge/ content/ suggestions/ previews/ CLAUDE.md .jfl/ scripts/ .gitmodules 2>/dev/null || true
38
+
39
+ # Use pathspec exclusion to ensure no submodules are staged
40
+ git reset HEAD product/ runner/ 2>/dev/null || true
41
+
42
+ # Check if there's anything to commit
43
+ if git diff --cached --quiet; then
44
+ echo "⚠️ No changes to commit (excluding product submodule)"
45
+ echo " Use ./scripts/commit-product.sh for product changes"
46
+ exit 0
47
+ fi
48
+
49
+ # Commit
50
+ git commit -m "$COMMIT_MSG"
51
+
52
+ # Push
53
+ git push origin main
54
+
55
+ echo ""
56
+ echo "✅ GTM changes committed and pushed!"
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # commit-product.sh - Commit changes to product submodule
4
+ #
5
+ # Usage:
6
+ # ./scripts/commit-product.sh "commit message"
7
+ #
8
+ # This handles all the submodule commit logic:
9
+ # - cd to product submodule
10
+ # - stage changes
11
+ # - commit
12
+ # - push to origin
13
+ # - update parent repo reference
14
+
15
+ set -e
16
+
17
+ if [[ -z "$1" ]]; then
18
+ echo "Usage: $0 \"commit message\""
19
+ exit 1
20
+ fi
21
+
22
+ COMMIT_MSG="$1"
23
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24
+ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
25
+ PRODUCT_DIR="$REPO_ROOT/product"
26
+
27
+ echo "📦 Committing to product submodule..."
28
+ echo ""
29
+
30
+ # Go to product submodule
31
+ cd "$PRODUCT_DIR"
32
+
33
+ # Check if on a branch
34
+ CURRENT_BRANCH=$(git branch --show-current)
35
+ if [[ -z "$CURRENT_BRANCH" ]]; then
36
+ echo "⚠️ You're in detached HEAD state"
37
+ echo " Checking out main first..."
38
+ git checkout main
39
+ fi
40
+
41
+ # Show what will be committed
42
+ echo "Changes to commit:"
43
+ git status --short
44
+ echo ""
45
+
46
+ # Stage all changes
47
+ git add -A
48
+
49
+ # Commit
50
+ git commit -m "$COMMIT_MSG"
51
+
52
+ # Push
53
+ git push origin main
54
+
55
+ # Update parent repo reference
56
+ cd "$REPO_ROOT"
57
+ git add product
58
+ git commit -m "chore: update product submodule
59
+
60
+ Latest commit: $(cd product && git log -1 --oneline)
61
+
62
+ Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>"
63
+ git push origin main
64
+
65
+ echo ""
66
+ echo "✅ Product changes committed and pushed!"
67
+ echo " Submodule: $PRODUCT_DIR"
68
+ echo " Parent updated to track latest"
@@ -0,0 +1,201 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # migrate-to-branch-sessions.sh - Migrate from worktree-based to branch-based sessions
4
+ #
5
+ # This script helps existing JFL users migrate to the new simplified session model.
6
+ # It handles:
7
+ # - Saving uncommitted work from worktrees
8
+ # - Merging session branches to main
9
+ # - Removing worktree directories
10
+ # - Cleaning up metadata files
11
+ #
12
+ # @purpose Migration from worktree sessions to branch-only sessions
13
+
14
+ set -e
15
+
16
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
+ REPO_DIR="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
18
+ WORKTREES_DIR="$REPO_DIR/worktrees"
19
+
20
+ # Colors
21
+ RED='\033[0;31m'
22
+ GREEN='\033[0;32m'
23
+ YELLOW='\033[1;33m'
24
+ BLUE='\033[0;34m'
25
+ CYAN='\033[0;36m'
26
+ NC='\033[0m'
27
+
28
+ echo ""
29
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
30
+ echo " JFL Migration: Worktree → Branch-Based Sessions"
31
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
32
+ echo ""
33
+ echo "This will migrate your project from worktree-based sessions to"
34
+ echo "simpler branch-based sessions."
35
+ echo ""
36
+ echo "What this does:"
37
+ echo " 1. Save any uncommitted work in worktrees"
38
+ echo " 2. Merge session branches to main"
39
+ echo " 3. Remove worktree directories"
40
+ echo " 4. Clean up metadata files"
41
+ echo ""
42
+
43
+ # Check if worktrees exist
44
+ if [[ ! -d "$WORKTREES_DIR" ]]; then
45
+ echo -e "${GREEN}✓${NC} No worktrees directory found - nothing to migrate"
46
+ exit 0
47
+ fi
48
+
49
+ # Count worktrees
50
+ worktree_count=$(find "$WORKTREES_DIR" -maxdepth 1 -type d -name "session-*" 2>/dev/null | wc -l | tr -d ' ')
51
+
52
+ if [[ $worktree_count -eq 0 ]]; then
53
+ echo -e "${GREEN}✓${NC} No worktrees found - nothing to migrate"
54
+ echo ""
55
+ echo "Cleaning up empty worktrees directory..."
56
+ rmdir "$WORKTREES_DIR" 2>/dev/null || true
57
+ exit 0
58
+ fi
59
+
60
+ echo -e "${YELLOW}⚠${NC} Found $worktree_count worktree(s) to migrate"
61
+ echo ""
62
+
63
+ # Ensure we're on main branch
64
+ current_branch=$(git branch --show-current 2>/dev/null || echo "")
65
+ if [[ "$current_branch" != "main" ]]; then
66
+ echo "Switching to main branch..."
67
+ git checkout main 2>/dev/null || {
68
+ echo -e "${RED}✗${NC} Failed to checkout main branch"
69
+ echo " Please switch to main manually and run this script again"
70
+ exit 1
71
+ }
72
+ fi
73
+
74
+ # Step 1: Save uncommitted work in worktrees
75
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
76
+ echo " Step 1: Checking for uncommitted work"
77
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
78
+ echo ""
79
+
80
+ for wt in "$WORKTREES_DIR"/session-*; do
81
+ if [[ -d "$wt" ]]; then
82
+ session_name=$(basename "$wt")
83
+ cd "$wt"
84
+
85
+ if git status --porcelain 2>/dev/null | grep -q .; then
86
+ echo -e "${YELLOW}⚠${NC} Uncommitted work in $session_name"
87
+ git status --short
88
+ echo ""
89
+ echo " Committing changes..."
90
+ git add -A
91
+ git commit -m "migration: auto-save uncommitted work before migration" || true
92
+ echo -e "${GREEN}✓${NC} Changes saved"
93
+ echo ""
94
+ else
95
+ echo -e "${GREEN}✓${NC} $session_name - no uncommitted changes"
96
+ fi
97
+
98
+ cd "$REPO_DIR"
99
+ fi
100
+ done
101
+
102
+ # Step 2: Merge session branches to main
103
+ echo ""
104
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
105
+ echo " Step 2: Merging session branches"
106
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
107
+ echo ""
108
+
109
+ # Get all session branches
110
+ session_branches=$(git branch | grep "session-" | sed 's/^[* ]*//' || true)
111
+
112
+ if [[ -z "$session_branches" ]]; then
113
+ echo -e "${GREEN}✓${NC} No session branches to merge"
114
+ else
115
+ for branch in $session_branches; do
116
+ echo "Merging $branch..."
117
+
118
+ # Try to merge
119
+ if git merge --no-edit "$branch" 2>/dev/null; then
120
+ echo -e "${GREEN}✓${NC} Merged $branch"
121
+
122
+ # Delete the branch
123
+ git branch -D "$branch" 2>/dev/null || true
124
+ else
125
+ # Merge conflicts - show them and skip
126
+ echo -e "${RED}✗${NC} Conflicts merging $branch"
127
+ echo ""
128
+ echo " Conflicting files:"
129
+ git diff --name-only --diff-filter=U 2>/dev/null | sed 's/^/ - /'
130
+ echo ""
131
+ echo " Aborting this merge - you'll need to merge $branch manually"
132
+ git merge --abort 2>/dev/null || true
133
+ echo ""
134
+ fi
135
+ done
136
+ fi
137
+
138
+ # Step 3: Clean up worktrees
139
+ echo ""
140
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
141
+ echo " Step 3: Removing worktrees"
142
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
143
+ echo ""
144
+
145
+ # Prune worktrees from git
146
+ echo "Pruning worktree references..."
147
+ git worktree prune 2>/dev/null || true
148
+
149
+ # Remove worktree directories
150
+ if [[ -d "$WORKTREES_DIR" ]]; then
151
+ echo "Removing worktrees directory..."
152
+ rm -rf "$WORKTREES_DIR" 2>/dev/null || {
153
+ echo -e "${YELLOW}⚠${NC} Could not remove $WORKTREES_DIR automatically"
154
+ echo " Please remove it manually: rm -rf $WORKTREES_DIR"
155
+ }
156
+ echo -e "${GREEN}✓${NC} Worktrees directory removed"
157
+ fi
158
+
159
+ # Step 4: Clean up metadata
160
+ echo ""
161
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
162
+ echo " Step 4: Cleaning up metadata"
163
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
164
+ echo ""
165
+
166
+ # Remove worktree metadata files
167
+ rm -f "$REPO_DIR/.jfl/current-worktree.txt" 2>/dev/null || true
168
+ rm -f "$REPO_DIR/.jfl/worktree-path.txt" 2>/dev/null || true
169
+
170
+ echo -e "${GREEN}✓${NC} Metadata cleaned up"
171
+
172
+ # Step 5: Summary
173
+ echo ""
174
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
175
+ echo " Migration Complete!"
176
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
177
+ echo ""
178
+ echo -e "${GREEN}✓${NC} Migration completed successfully"
179
+ echo ""
180
+ echo "What changed:"
181
+ echo " • Worktree directories removed"
182
+ echo " • Session branches merged to main (where possible)"
183
+ echo " • Metadata files cleaned up"
184
+ echo ""
185
+ echo "What's next:"
186
+ echo " • New sessions will use simple branch-based isolation"
187
+ echo " • No more worktree complexity or background processes"
188
+ echo " • Run 'git status' to verify everything is clean"
189
+ echo ""
190
+
191
+ # Check for remaining session branches that weren't merged
192
+ remaining_branches=$(git branch | grep "session-" | sed 's/^[* ]*//' || true)
193
+ if [[ -n "$remaining_branches" ]]; then
194
+ echo -e "${YELLOW}⚠${NC} Note: Some session branches still exist (had conflicts):"
195
+ echo "$remaining_branches" | sed 's/^/ - /'
196
+ echo ""
197
+ echo " You can merge or delete these manually:"
198
+ echo " git merge <branch-name> # to merge"
199
+ echo " git branch -D <branch-name> # to delete"
200
+ echo ""
201
+ fi
@@ -73,8 +73,9 @@ do_commit() {
73
73
  git add $paths
74
74
  git commit -m "$MSG" || return 0
75
75
 
76
- # Push after commit - from ours
77
- git push origin main 2>/dev/null || echo "[$(date '+%H:%M:%S')] Push failed - will retry"
76
+ # Push after commit to current branch
77
+ local current_branch=$(git branch --show-current)
78
+ git push origin "$current_branch" 2>/dev/null || echo "[$(date '+%H:%M:%S')] Push failed - will retry"
78
79
 
79
80
  echo "[$(date '+%H:%M:%S')] Committed: $MSG"
80
81
  }
@@ -153,7 +154,7 @@ graceful_shutdown() {
153
154
  commit_submodules_if_changes
154
155
  } >> "$LOG_FILE" 2>&1
155
156
 
156
- # Run session cleanup (auto-merge if safe)
157
+ # Run session cleanup (auto-merge and remove worktree if safe)
157
158
  if [[ -f "$SCRIPT_DIR/session-cleanup.sh" ]]; then
158
159
  echo "[$(date '+%H:%M:%S')] Running session cleanup..." >> "$LOG_FILE" 2>&1
159
160
  bash "$SCRIPT_DIR/session-cleanup.sh" >> "$LOG_FILE" 2>&1 || true