jfl 0.1.0 → 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.
- package/README.md +443 -145
- package/clawdbot-plugin/clawdbot.plugin.json +20 -0
- package/clawdbot-plugin/index.js +555 -0
- package/clawdbot-plugin/index.ts +582 -0
- package/clawdbot-skill/SKILL.md +33 -336
- package/clawdbot-skill/index.ts +491 -321
- package/clawdbot-skill/skill.json +4 -13
- package/dist/commands/clawdbot.d.ts +11 -0
- package/dist/commands/clawdbot.d.ts.map +1 -0
- package/dist/commands/clawdbot.js +215 -0
- package/dist/commands/clawdbot.js.map +1 -0
- package/dist/commands/context-hub.d.ts +5 -0
- package/dist/commands/context-hub.d.ts.map +1 -1
- package/dist/commands/context-hub.js +394 -28
- package/dist/commands/context-hub.js.map +1 -1
- package/dist/commands/gtm-process-update.d.ts +10 -0
- package/dist/commands/gtm-process-update.d.ts.map +1 -0
- package/dist/commands/gtm-process-update.js +101 -0
- package/dist/commands/gtm-process-update.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +278 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +32 -33
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/memory.d.ts +38 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +229 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/migrate-services.d.ts +8 -0
- package/dist/commands/migrate-services.d.ts.map +1 -0
- package/dist/commands/migrate-services.js +182 -0
- package/dist/commands/migrate-services.js.map +1 -0
- package/dist/commands/onboard.d.ts +24 -0
- package/dist/commands/onboard.d.ts.map +1 -0
- package/dist/commands/onboard.js +663 -0
- package/dist/commands/onboard.js.map +1 -0
- package/dist/commands/openclaw.d.ts +56 -0
- package/dist/commands/openclaw.d.ts.map +1 -0
- package/dist/commands/openclaw.js +700 -0
- package/dist/commands/openclaw.js.map +1 -0
- package/dist/commands/orchestrate.d.ts +14 -0
- package/dist/commands/orchestrate.d.ts.map +1 -0
- package/dist/commands/orchestrate.js +270 -0
- package/dist/commands/orchestrate.js.map +1 -0
- package/dist/commands/profile.d.ts +46 -0
- package/dist/commands/profile.d.ts.map +1 -0
- package/dist/commands/profile.js +498 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/commands/repair.d.ts.map +1 -1
- package/dist/commands/repair.js +37 -0
- package/dist/commands/repair.js.map +1 -1
- package/dist/commands/service-agent.d.ts +16 -0
- package/dist/commands/service-agent.d.ts.map +1 -0
- package/dist/commands/service-agent.js +375 -0
- package/dist/commands/service-agent.js.map +1 -0
- package/dist/commands/service-manager.d.ts +12 -0
- package/dist/commands/service-manager.d.ts.map +1 -0
- package/dist/commands/service-manager.js +967 -0
- package/dist/commands/service-manager.js.map +1 -0
- package/dist/commands/service-validate.d.ts +12 -0
- package/dist/commands/service-validate.d.ts.map +1 -0
- package/dist/commands/service-validate.js +611 -0
- package/dist/commands/service-validate.js.map +1 -0
- package/dist/commands/services-create.d.ts +15 -0
- package/dist/commands/services-create.d.ts.map +1 -0
- package/dist/commands/services-create.js +1452 -0
- package/dist/commands/services-create.js.map +1 -0
- package/dist/commands/services-scan.d.ts +13 -0
- package/dist/commands/services-scan.d.ts.map +1 -0
- package/dist/commands/services-scan.js +251 -0
- package/dist/commands/services-scan.js.map +1 -0
- package/dist/commands/services-sync-agents.d.ts +23 -0
- package/dist/commands/services-sync-agents.d.ts.map +1 -0
- package/dist/commands/services-sync-agents.js +207 -0
- package/dist/commands/services-sync-agents.js.map +1 -0
- package/dist/commands/services.d.ts +19 -0
- package/dist/commands/services.d.ts.map +1 -0
- package/dist/commands/services.js +742 -0
- package/dist/commands/services.js.map +1 -0
- package/dist/commands/session.d.ts +5 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +68 -586
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +17 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +75 -21
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/validate-settings.d.ts +37 -0
- package/dist/commands/validate-settings.d.ts.map +1 -0
- package/dist/commands/validate-settings.js +197 -0
- package/dist/commands/validate-settings.js.map +1 -0
- package/dist/commands/voice.d.ts +0 -1
- package/dist/commands/voice.d.ts.map +1 -1
- package/dist/commands/voice.js +16 -15
- package/dist/commands/voice.js.map +1 -1
- package/dist/index.js +395 -141
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-generator.d.ts +26 -0
- package/dist/lib/agent-generator.d.ts.map +1 -0
- package/dist/lib/agent-generator.js +331 -0
- package/dist/lib/agent-generator.js.map +1 -0
- package/dist/lib/memory-db.d.ts +102 -0
- package/dist/lib/memory-db.d.ts.map +1 -0
- package/dist/lib/memory-db.js +313 -0
- package/dist/lib/memory-db.js.map +1 -0
- package/dist/lib/memory-indexer.d.ts +47 -0
- package/dist/lib/memory-indexer.d.ts.map +1 -0
- package/dist/lib/memory-indexer.js +215 -0
- package/dist/lib/memory-indexer.js.map +1 -0
- package/dist/lib/memory-search.d.ts +41 -0
- package/dist/lib/memory-search.d.ts.map +1 -0
- package/dist/lib/memory-search.js +246 -0
- package/dist/lib/memory-search.js.map +1 -0
- package/dist/lib/openclaw-registry.d.ts +48 -0
- package/dist/lib/openclaw-registry.d.ts.map +1 -0
- package/dist/lib/openclaw-registry.js +181 -0
- package/dist/lib/openclaw-registry.js.map +1 -0
- package/dist/lib/openclaw-sdk.d.ts +107 -0
- package/dist/lib/openclaw-sdk.d.ts.map +1 -0
- package/dist/lib/openclaw-sdk.js +208 -0
- package/dist/lib/openclaw-sdk.js.map +1 -0
- package/dist/lib/peer-agent-generator.d.ts +44 -0
- package/dist/lib/peer-agent-generator.d.ts.map +1 -0
- package/dist/lib/peer-agent-generator.js +286 -0
- package/dist/lib/peer-agent-generator.js.map +1 -0
- package/dist/lib/service-dependencies.d.ts +44 -0
- package/dist/lib/service-dependencies.d.ts.map +1 -0
- package/dist/lib/service-dependencies.js +314 -0
- package/dist/lib/service-dependencies.js.map +1 -0
- package/dist/lib/service-detector.d.ts +61 -0
- package/dist/lib/service-detector.d.ts.map +1 -0
- package/dist/lib/service-detector.js +521 -0
- package/dist/lib/service-detector.js.map +1 -0
- package/dist/lib/service-gtm.d.ts +157 -0
- package/dist/lib/service-gtm.d.ts.map +1 -0
- package/dist/lib/service-gtm.js +786 -0
- package/dist/lib/service-gtm.js.map +1 -0
- package/dist/lib/service-mcp-base.d.ts +103 -0
- package/dist/lib/service-mcp-base.d.ts.map +1 -0
- package/dist/lib/service-mcp-base.js +263 -0
- package/dist/lib/service-mcp-base.js.map +1 -0
- package/dist/lib/service-utils.d.ts +103 -0
- package/dist/lib/service-utils.d.ts.map +1 -0
- package/dist/lib/service-utils.js +368 -0
- package/dist/lib/service-utils.js.map +1 -0
- package/dist/lib/skill-generator.d.ts +21 -0
- package/dist/lib/skill-generator.d.ts.map +1 -0
- package/dist/lib/skill-generator.js +253 -0
- package/dist/lib/skill-generator.js.map +1 -0
- package/dist/lib/stratus-client.d.ts +100 -0
- package/dist/lib/stratus-client.d.ts.map +1 -0
- package/dist/lib/stratus-client.js +255 -0
- package/dist/lib/stratus-client.js.map +1 -0
- package/dist/mcp/context-hub-mcp.js +135 -53
- package/dist/mcp/context-hub-mcp.js.map +1 -1
- package/dist/mcp/service-mcp-server.d.ts +12 -0
- package/dist/mcp/service-mcp-server.d.ts.map +1 -0
- package/dist/mcp/service-mcp-server.js +434 -0
- package/dist/mcp/service-mcp-server.js.map +1 -0
- package/dist/mcp/service-peer-mcp.d.ts +36 -0
- package/dist/mcp/service-peer-mcp.d.ts.map +1 -0
- package/dist/mcp/service-peer-mcp.js +220 -0
- package/dist/mcp/service-peer-mcp.js.map +1 -0
- package/dist/mcp/service-registry-mcp.d.ts +13 -0
- package/dist/mcp/service-registry-mcp.d.ts.map +1 -0
- package/dist/mcp/service-registry-mcp.js +330 -0
- package/dist/mcp/service-registry-mcp.js.map +1 -0
- package/dist/ui/banner.js +1 -1
- package/dist/ui/banner.js.map +1 -1
- package/dist/ui/context-hub-logs.d.ts +10 -0
- package/dist/ui/context-hub-logs.d.ts.map +1 -0
- package/dist/ui/context-hub-logs.js +175 -0
- package/dist/ui/context-hub-logs.js.map +1 -0
- package/dist/ui/service-dashboard.d.ts +11 -0
- package/dist/ui/service-dashboard.d.ts.map +1 -0
- package/dist/ui/service-dashboard.js +357 -0
- package/dist/ui/service-dashboard.js.map +1 -0
- package/dist/ui/services-manager.d.ts +11 -0
- package/dist/ui/services-manager.d.ts.map +1 -0
- package/dist/ui/services-manager.js +507 -0
- package/dist/ui/services-manager.js.map +1 -0
- package/dist/utils/auth-guard.d.ts.map +1 -1
- package/dist/utils/auth-guard.js +8 -9
- package/dist/utils/auth-guard.js.map +1 -1
- package/dist/utils/claude-md-generator.d.ts +10 -0
- package/dist/utils/claude-md-generator.d.ts.map +1 -0
- package/dist/utils/claude-md-generator.js +215 -0
- package/dist/utils/claude-md-generator.js.map +1 -0
- package/dist/utils/ensure-context-hub.d.ts +20 -0
- package/dist/utils/ensure-context-hub.d.ts.map +1 -0
- package/dist/utils/ensure-context-hub.js +65 -0
- package/dist/utils/ensure-context-hub.js.map +1 -0
- package/dist/utils/ensure-project.d.ts.map +1 -1
- package/dist/utils/ensure-project.js +3 -4
- package/dist/utils/ensure-project.js.map +1 -1
- package/dist/utils/jfl-config.d.ts +19 -0
- package/dist/utils/jfl-config.d.ts.map +1 -0
- package/dist/utils/jfl-config.js +112 -0
- package/dist/utils/jfl-config.js.map +1 -0
- package/dist/utils/jfl-migration.d.ts +29 -0
- package/dist/utils/jfl-migration.d.ts.map +1 -0
- package/dist/utils/jfl-migration.js +142 -0
- package/dist/utils/jfl-migration.js.map +1 -0
- package/dist/utils/jfl-paths.d.ts +55 -0
- package/dist/utils/jfl-paths.d.ts.map +1 -0
- package/dist/utils/jfl-paths.js +120 -0
- package/dist/utils/jfl-paths.js.map +1 -0
- package/dist/utils/settings-validator.d.ts +73 -0
- package/dist/utils/settings-validator.d.ts.map +1 -0
- package/dist/utils/settings-validator.js +222 -0
- package/dist/utils/settings-validator.js.map +1 -0
- package/package.json +19 -3
- package/scripts/commit-gtm.sh +56 -0
- package/scripts/commit-product.sh +68 -0
- package/scripts/context-query.sh +45 -0
- package/scripts/session/auto-commit.sh +297 -0
- package/scripts/session/jfl-doctor.sh +707 -0
- package/scripts/session/session-cleanup.sh +268 -0
- package/scripts/session/session-end.sh +198 -0
- package/scripts/session/session-init.sh +350 -0
- package/scripts/session/session-init.sh.backup +292 -0
- package/scripts/session/session-sync.sh +167 -0
- package/scripts/session/test-context-preservation.sh +160 -0
- package/scripts/session/test-critical-infrastructure.sh +293 -0
- package/scripts/session/test-experience-level.sh +336 -0
- package/scripts/session/test-session-cleanup.sh +268 -0
- package/scripts/session/test-session-sync.sh +320 -0
- package/scripts/voice-start.sh +36 -8
- package/scripts/where-am-i.sh +78 -0
- package/template/.claude/service-settings.json +32 -0
- package/template/.claude/settings.json +14 -1
- package/template/.claude/skills/end/SKILL.md +1780 -0
- package/template/.jfl/config.json +2 -1
- package/template/CLAUDE.md +1039 -134
- package/template/CLAUDE.md.bak +1187 -0
- package/template/scripts/commit-gtm.sh +56 -0
- package/template/scripts/commit-product.sh +68 -0
- package/template/scripts/migrate-to-branch-sessions.sh +201 -0
- package/template/scripts/session/auto-commit.sh +58 -6
- package/template/scripts/session/jfl-doctor.sh +137 -17
- package/template/scripts/session/session-cleanup.sh +268 -0
- package/template/scripts/session/session-end.sh +4 -0
- package/template/scripts/session/session-init.sh +253 -66
- package/template/scripts/session/test-critical-infrastructure.sh +293 -0
- package/template/scripts/session/test-experience-level.sh +336 -0
- package/template/scripts/session/test-session-cleanup.sh +268 -0
- package/template/scripts/session/test-session-sync.sh +320 -0
- package/template/scripts/where-am-i.sh +78 -0
- package/template/templates/service-agent/.claude/settings.json +32 -0
- package/template/templates/service-agent/CLAUDE.md +334 -0
- package/template/templates/service-agent/knowledge/ARCHITECTURE.md +115 -0
- package/template/templates/service-agent/knowledge/DEPLOYMENT.md +199 -0
- package/template/templates/service-agent/knowledge/RUNBOOK.md +412 -0
- package/template/templates/service-agent/knowledge/SERVICE_SPEC.md +77 -0
- package/dist/commands/session-mgmt.d.ts +0 -33
- package/dist/commands/session-mgmt.d.ts.map +0 -1
- package/dist/commands/session-mgmt.js +0 -404
- package/dist/commands/session-mgmt.js.map +0 -1
- package/template/scripts/session/auto-merge.sh +0 -325
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jfl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Just Fucking Launch - CLI for AI-powered GTM and development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"jfl": "dist/index.js",
|
|
9
|
-
"jfl-context-hub-mcp": "dist/mcp/context-hub-mcp.js"
|
|
9
|
+
"jfl-context-hub-mcp": "dist/mcp/context-hub-mcp.js",
|
|
10
|
+
"jfl-service-registry-mcp": "dist/mcp/service-registry-mcp.js"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
12
13
|
"dist",
|
|
13
14
|
"scripts",
|
|
14
15
|
"template",
|
|
15
16
|
"clawdbot-skill",
|
|
17
|
+
"clawdbot-plugin",
|
|
16
18
|
"README.md",
|
|
17
19
|
"LICENSE"
|
|
18
20
|
],
|
|
@@ -20,6 +22,9 @@
|
|
|
20
22
|
"build": "tsc",
|
|
21
23
|
"dev": "tsx --watch src/index.ts",
|
|
22
24
|
"start": "node dist/index.js",
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"test:watch": "jest --watch",
|
|
27
|
+
"test:coverage": "jest --coverage",
|
|
23
28
|
"prepublishOnly": "npm run build",
|
|
24
29
|
"postinstall": "node scripts/postinstall.js"
|
|
25
30
|
},
|
|
@@ -45,16 +50,20 @@
|
|
|
45
50
|
"bugs": {
|
|
46
51
|
"url": "https://github.com/402goose/jfl-cli/issues"
|
|
47
52
|
},
|
|
48
|
-
"homepage": "https://jfl.run",
|
|
49
53
|
"engines": {
|
|
50
54
|
"node": ">=18.0.0"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
57
|
+
"@anthropic-ai/sdk": "^0.73.0",
|
|
53
58
|
"@clack/prompts": "^0.11.0",
|
|
54
59
|
"@scure/bip32": "^2.0.1",
|
|
55
60
|
"@scure/bip39": "^2.0.1",
|
|
61
|
+
"@types/blessed": "^0.1.27",
|
|
56
62
|
"@x402/core": "^2.2.0",
|
|
57
63
|
"@x402/evm": "^2.2.0",
|
|
64
|
+
"axios": "^1.13.4",
|
|
65
|
+
"blessed": "^0.1.81",
|
|
66
|
+
"blessed-contrib": "^4.11.0",
|
|
58
67
|
"chalk": "^5.3.0",
|
|
59
68
|
"commander": "^12.0.0",
|
|
60
69
|
"conf": "^12.0.0",
|
|
@@ -62,14 +71,21 @@
|
|
|
62
71
|
"inquirer": "^9.2.14",
|
|
63
72
|
"node-global-key-listener": "^0.3.0",
|
|
64
73
|
"open": "^10.0.0",
|
|
74
|
+
"openai": "^4.104.0",
|
|
65
75
|
"ora": "^8.0.1",
|
|
76
|
+
"sql.js": "^1.13.0",
|
|
66
77
|
"viem": "^2.44.4",
|
|
67
78
|
"ws": "^8.16.0"
|
|
68
79
|
},
|
|
69
80
|
"devDependencies": {
|
|
70
81
|
"@types/inquirer": "^9.0.7",
|
|
82
|
+
"@types/jest": "^30.0.0",
|
|
71
83
|
"@types/node": "^20.11.0",
|
|
84
|
+
"@types/react": "^19.2.13",
|
|
85
|
+
"@types/sql.js": "^1.4.9",
|
|
72
86
|
"@types/ws": "^8.18.1",
|
|
87
|
+
"jest": "^30.2.0",
|
|
88
|
+
"ts-jest": "^29.4.6",
|
|
73
89
|
"tsx": "^4.7.0",
|
|
74
90
|
"typescript": "^5.3.3"
|
|
75
91
|
}
|
|
@@ -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,45 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Helper script to query Context Hub
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# ./scripts/context-query.sh # Get all context
|
|
7
|
+
# ./scripts/context-query.sh search "session" # Search for term
|
|
8
|
+
# ./scripts/context-query.sh status # Show status
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
ACTION="${1:-all}"
|
|
12
|
+
QUERY="$2"
|
|
13
|
+
TOKEN=$(cat .jfl/context-hub.token 2>/dev/null)
|
|
14
|
+
|
|
15
|
+
if [ -z "$TOKEN" ]; then
|
|
16
|
+
echo "Error: No token found. Is Context Hub running?"
|
|
17
|
+
echo "Run: jfl context-hub start"
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
case "$ACTION" in
|
|
22
|
+
status)
|
|
23
|
+
curl -s -H "Authorization: Bearer $TOKEN" \
|
|
24
|
+
http://localhost:4242/api/context/status | python3 -m json.tool
|
|
25
|
+
;;
|
|
26
|
+
|
|
27
|
+
search)
|
|
28
|
+
if [ -z "$QUERY" ]; then
|
|
29
|
+
echo "Usage: $0 search <query>"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
curl -s -X POST \
|
|
33
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
34
|
+
-H "Content-Type: application/json" \
|
|
35
|
+
-d "{\"query\": \"$QUERY\", \"maxItems\": 10}" \
|
|
36
|
+
http://localhost:4242/api/context/search | python3 -m json.tool
|
|
37
|
+
;;
|
|
38
|
+
|
|
39
|
+
all|*)
|
|
40
|
+
curl -s -X POST \
|
|
41
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
42
|
+
-H "Content-Type: application/json" \
|
|
43
|
+
http://localhost:4242/api/context | python3 -m json.tool
|
|
44
|
+
;;
|
|
45
|
+
esac
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Auto-commit script for JFL projects
|
|
4
|
+
# Runs in background, commits changes at specified interval
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# ./scripts/session/auto-commit.sh start [INTERVAL] # Start (default 120s)
|
|
8
|
+
# ./scripts/session/auto-commit.sh stop # Stop background process
|
|
9
|
+
# ./scripts/session/auto-commit.sh status # Check if running
|
|
10
|
+
# ./scripts/session/auto-commit.sh once # Run once (for testing)
|
|
11
|
+
#
|
|
12
|
+
# Merges best of:
|
|
13
|
+
# - Original JFL auto-commit (smart messages, author detection, pull first)
|
|
14
|
+
# - Session protection (push after, product handling, faster interval)
|
|
15
|
+
|
|
16
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
# Use current working directory (where script is called from), not script location
|
|
18
|
+
REPO_DIR="$(pwd)"
|
|
19
|
+
PID_FILE="$REPO_DIR/.jfl/auto-commit.pid"
|
|
20
|
+
LOG_FILE="$REPO_DIR/.jfl/auto-commit.log"
|
|
21
|
+
INTERVAL=${2:-120} # Default 2 minutes (was 5 in original)
|
|
22
|
+
|
|
23
|
+
mkdir -p "$REPO_DIR/.jfl"
|
|
24
|
+
cd "$REPO_DIR" || exit 1
|
|
25
|
+
|
|
26
|
+
# Critical paths to always include
|
|
27
|
+
CRITICAL_PATHS=(
|
|
28
|
+
"knowledge/"
|
|
29
|
+
"previews/"
|
|
30
|
+
"content/"
|
|
31
|
+
"suggestions/"
|
|
32
|
+
"CLAUDE.md"
|
|
33
|
+
".jfl/journal/"
|
|
34
|
+
".jfl/config.json"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
do_commit() {
|
|
38
|
+
# Pull latest first (sync with team) - from original
|
|
39
|
+
git pull --rebase --quiet 2>/dev/null || true
|
|
40
|
+
|
|
41
|
+
# Build paths string
|
|
42
|
+
local paths=""
|
|
43
|
+
for p in "${CRITICAL_PATHS[@]}"; do
|
|
44
|
+
if [ -e "$p" ]; then
|
|
45
|
+
paths="$paths $p"
|
|
46
|
+
fi
|
|
47
|
+
done
|
|
48
|
+
|
|
49
|
+
# Check for changes
|
|
50
|
+
if [[ -z $(git status --porcelain $paths 2>/dev/null) ]]; then
|
|
51
|
+
return 0 # Nothing to commit
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# Get list of changed files for commit message - from original
|
|
55
|
+
CHANGED=$(git status --porcelain $paths | head -5 | awk '{print $2}' | tr '\n' ', ' | sed 's/,$//')
|
|
56
|
+
CHANGE_COUNT=$(git status --porcelain $paths | wc -l | tr -d ' ')
|
|
57
|
+
|
|
58
|
+
# Try to identify who's working (check recent suggestions files) - from original
|
|
59
|
+
AUTHOR="auto"
|
|
60
|
+
RECENT_SUGGESTION=$(ls -t suggestions/*.md 2>/dev/null | head -1)
|
|
61
|
+
if [[ -n "$RECENT_SUGGESTION" ]]; then
|
|
62
|
+
AUTHOR=$(basename "$RECENT_SUGGESTION" .md)
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# Generate commit message - from original style
|
|
66
|
+
if [[ $CHANGE_COUNT -gt 5 ]]; then
|
|
67
|
+
MSG="$AUTHOR: auto-save ($CHANGE_COUNT files including $CHANGED...)"
|
|
68
|
+
else
|
|
69
|
+
MSG="$AUTHOR: auto-save ($CHANGED)"
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Commit
|
|
73
|
+
git add $paths
|
|
74
|
+
git commit -m "$MSG" || return 0
|
|
75
|
+
|
|
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"
|
|
79
|
+
|
|
80
|
+
echo "[$(date '+%H:%M:%S')] Committed: $MSG"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Commit and push changes in ALL submodules with feature branches
|
|
84
|
+
commit_submodules_if_changes() {
|
|
85
|
+
local submodules_dir="$REPO_DIR/.jfl/submodules"
|
|
86
|
+
|
|
87
|
+
# If no submodules directory, fall back to legacy product-only handling
|
|
88
|
+
if [[ ! -d "$submodules_dir" ]]; then
|
|
89
|
+
# Legacy: check for product-branch file
|
|
90
|
+
local product_branch_file="$REPO_DIR/.jfl/product-branch"
|
|
91
|
+
if [[ -f "$product_branch_file" ]]; then
|
|
92
|
+
commit_single_submodule "product" "$(cat "$product_branch_file")"
|
|
93
|
+
fi
|
|
94
|
+
return 0
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
# Iterate through all submodule branch files (use find for nested paths like libs/mylib)
|
|
98
|
+
while IFS= read -r -d '' branch_file; do
|
|
99
|
+
if [[ -f "$branch_file" ]]; then
|
|
100
|
+
# Get submodule path by stripping the prefix directory
|
|
101
|
+
local submodule_path="${branch_file#$submodules_dir/}"
|
|
102
|
+
local target_branch=$(cat "$branch_file")
|
|
103
|
+
commit_single_submodule "$submodule_path" "$target_branch"
|
|
104
|
+
fi
|
|
105
|
+
done < <(find "$submodules_dir" -type f -print0 2>/dev/null)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Commit changes in a single submodule
|
|
109
|
+
commit_single_submodule() {
|
|
110
|
+
local submodule_path="$1"
|
|
111
|
+
local target_branch="$2"
|
|
112
|
+
local full_path="$REPO_DIR/$submodule_path"
|
|
113
|
+
|
|
114
|
+
# Resolve symlink if needed
|
|
115
|
+
if [[ -L "$full_path" ]]; then
|
|
116
|
+
full_path=$(cd "$full_path" 2>/dev/null && pwd) || return 0
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Check if submodule has git
|
|
120
|
+
if [[ -d "$full_path/.git" ]] || [[ -f "$full_path/.git" ]]; then
|
|
121
|
+
cd "$full_path"
|
|
122
|
+
|
|
123
|
+
if [[ -n $(git status --porcelain 2>/dev/null) ]]; then
|
|
124
|
+
# Make sure we're on the right branch
|
|
125
|
+
local current_branch=$(git branch --show-current 2>/dev/null)
|
|
126
|
+
if [[ "$current_branch" != "$target_branch" ]] && [[ "$target_branch" != "main" ]]; then
|
|
127
|
+
git checkout "$target_branch" 2>/dev/null || true
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
git add -A
|
|
131
|
+
git commit -m "auto: $submodule_path save ($(date '+%Y-%m-%d %H:%M'))" || true
|
|
132
|
+
|
|
133
|
+
# Push to feature branch (NOT main)
|
|
134
|
+
if [[ "$target_branch" != "main" ]]; then
|
|
135
|
+
git push origin "$target_branch" 2>/dev/null || true
|
|
136
|
+
echo "[$(date '+%H:%M:%S')] $submodule_path committed to branch: $target_branch"
|
|
137
|
+
else
|
|
138
|
+
# No feature branch - warn but don't push to main
|
|
139
|
+
echo "[$(date '+%H:%M:%S')] $submodule_path committed locally (no feature branch set)"
|
|
140
|
+
fi
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
cd "$REPO_DIR"
|
|
144
|
+
fi
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
# Graceful shutdown handler - ensures final commit before exit
|
|
148
|
+
graceful_shutdown() {
|
|
149
|
+
echo "[$(date '+%H:%M:%S')] Received shutdown signal - saving final changes..." >> "$LOG_FILE" 2>&1
|
|
150
|
+
|
|
151
|
+
# Run final commit to save any pending work
|
|
152
|
+
{
|
|
153
|
+
do_commit
|
|
154
|
+
commit_submodules_if_changes
|
|
155
|
+
} >> "$LOG_FILE" 2>&1
|
|
156
|
+
|
|
157
|
+
# Run session cleanup (auto-merge and remove worktree if safe)
|
|
158
|
+
if [[ -f "$SCRIPT_DIR/session-cleanup.sh" ]]; then
|
|
159
|
+
echo "[$(date '+%H:%M:%S')] Running session cleanup..." >> "$LOG_FILE" 2>&1
|
|
160
|
+
bash "$SCRIPT_DIR/session-cleanup.sh" >> "$LOG_FILE" 2>&1 || true
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
echo "[$(date '+%H:%M:%S')] Shutdown complete." >> "$LOG_FILE" 2>&1
|
|
164
|
+
rm -f "$PID_FILE"
|
|
165
|
+
exit 0
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
start_daemon() {
|
|
169
|
+
if [[ -f "$PID_FILE" ]]; then
|
|
170
|
+
local pid=$(cat "$PID_FILE")
|
|
171
|
+
if kill -0 "$pid" 2>/dev/null; then
|
|
172
|
+
echo "Auto-commit already running (PID: $pid)"
|
|
173
|
+
return 0
|
|
174
|
+
fi
|
|
175
|
+
rm -f "$PID_FILE"
|
|
176
|
+
fi
|
|
177
|
+
|
|
178
|
+
echo "Starting auto-commit daemon (interval: ${INTERVAL}s)..."
|
|
179
|
+
|
|
180
|
+
# Run in background with signal handling
|
|
181
|
+
# Close inherited file descriptors so parent doesn't wait for us
|
|
182
|
+
(
|
|
183
|
+
exec </dev/null >/dev/null 2>&1
|
|
184
|
+
|
|
185
|
+
# Trap signals for graceful shutdown (added SIGHUP for terminal close)
|
|
186
|
+
trap graceful_shutdown SIGINT SIGTERM SIGQUIT SIGHUP
|
|
187
|
+
|
|
188
|
+
# Track parent process to detect when Claude dies
|
|
189
|
+
INITIAL_PPID=$PPID
|
|
190
|
+
|
|
191
|
+
while true; do
|
|
192
|
+
{
|
|
193
|
+
# Check if parent process (Claude) is still alive
|
|
194
|
+
if ! kill -0 "$INITIAL_PPID" 2>/dev/null; then
|
|
195
|
+
echo "[$(date '+%H:%M:%S')] Parent process died (PPID $INITIAL_PPID) - running cleanup..."
|
|
196
|
+
graceful_shutdown
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
echo "[$(date '+%H:%M:%S')] Checking for changes..."
|
|
200
|
+
do_commit
|
|
201
|
+
commit_submodules_if_changes
|
|
202
|
+
} >> "$LOG_FILE" 2>&1
|
|
203
|
+
sleep "$INTERVAL"
|
|
204
|
+
done
|
|
205
|
+
) &
|
|
206
|
+
|
|
207
|
+
DAEMON_PID=$!
|
|
208
|
+
echo "$DAEMON_PID" > "$PID_FILE"
|
|
209
|
+
echo "Auto-commit started (PID: $DAEMON_PID)"
|
|
210
|
+
echo "Log: $LOG_FILE"
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
stop_daemon() {
|
|
214
|
+
if [[ -f "$PID_FILE" ]]; then
|
|
215
|
+
local pid=$(cat "$PID_FILE")
|
|
216
|
+
if kill -0 "$pid" 2>/dev/null; then
|
|
217
|
+
echo "Stopping auto-commit (PID: $pid)..."
|
|
218
|
+
|
|
219
|
+
# Send SIGTERM for graceful shutdown (runs final commit)
|
|
220
|
+
kill -TERM "$pid" 2>/dev/null
|
|
221
|
+
|
|
222
|
+
# Wait up to 10 seconds for graceful shutdown
|
|
223
|
+
local wait_count=0
|
|
224
|
+
while kill -0 "$pid" 2>/dev/null && [ $wait_count -lt 20 ]; do
|
|
225
|
+
sleep 0.5
|
|
226
|
+
wait_count=$((wait_count + 1))
|
|
227
|
+
done
|
|
228
|
+
|
|
229
|
+
# If still running after timeout, force kill
|
|
230
|
+
if kill -0 "$pid" 2>/dev/null; then
|
|
231
|
+
echo "Graceful shutdown timed out, forcing..."
|
|
232
|
+
kill -9 "$pid" 2>/dev/null
|
|
233
|
+
rm -f "$PID_FILE"
|
|
234
|
+
fi
|
|
235
|
+
|
|
236
|
+
echo "Stopped."
|
|
237
|
+
else
|
|
238
|
+
echo "Process not running (stale PID file)"
|
|
239
|
+
rm -f "$PID_FILE"
|
|
240
|
+
fi
|
|
241
|
+
else
|
|
242
|
+
echo "Auto-commit not running"
|
|
243
|
+
fi
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
show_status() {
|
|
247
|
+
if [[ -f "$PID_FILE" ]]; then
|
|
248
|
+
local pid=$(cat "$PID_FILE")
|
|
249
|
+
if kill -0 "$pid" 2>/dev/null; then
|
|
250
|
+
echo "Auto-commit running (PID: $pid)"
|
|
251
|
+
echo "Interval: ${INTERVAL}s"
|
|
252
|
+
echo "Log: $LOG_FILE"
|
|
253
|
+
echo ""
|
|
254
|
+
echo "Recent activity:"
|
|
255
|
+
tail -5 "$LOG_FILE" 2>/dev/null || echo " (no log yet)"
|
|
256
|
+
return 0
|
|
257
|
+
fi
|
|
258
|
+
fi
|
|
259
|
+
echo "Auto-commit not running"
|
|
260
|
+
return 1
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
run_once() {
|
|
264
|
+
echo "Running single commit check..."
|
|
265
|
+
do_commit
|
|
266
|
+
commit_submodules_if_changes
|
|
267
|
+
echo "Done."
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
case "${1:-}" in
|
|
271
|
+
start)
|
|
272
|
+
start_daemon
|
|
273
|
+
;;
|
|
274
|
+
stop)
|
|
275
|
+
stop_daemon
|
|
276
|
+
;;
|
|
277
|
+
status)
|
|
278
|
+
show_status
|
|
279
|
+
;;
|
|
280
|
+
once)
|
|
281
|
+
run_once
|
|
282
|
+
;;
|
|
283
|
+
*)
|
|
284
|
+
echo "Auto-commit for JFL projects"
|
|
285
|
+
echo ""
|
|
286
|
+
echo "Usage:"
|
|
287
|
+
echo " $0 start [INTERVAL] Start daemon (default: 120s)"
|
|
288
|
+
echo " $0 stop Stop daemon"
|
|
289
|
+
echo " $0 status Show status"
|
|
290
|
+
echo " $0 once Run once"
|
|
291
|
+
echo ""
|
|
292
|
+
echo "Examples:"
|
|
293
|
+
echo " $0 start 60 Start with 1-minute interval"
|
|
294
|
+
echo " $0 start Start with 2-minute interval"
|
|
295
|
+
exit 1
|
|
296
|
+
;;
|
|
297
|
+
esac
|