crewly 1.5.15 → 1.5.17
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/config/skills/agent/browse-stealth/stealth-browse.py +7 -2
- package/config/skills/agent/core/recall/SKILL.md +22 -9
- package/config/skills/agent/core/recall/execute.sh +94 -17
- package/config/skills/agent/core/record-learning/SKILL.md +22 -10
- package/config/skills/agent/core/record-learning/execute.sh +91 -22
- package/config/skills/agent/core/remember/SKILL.md +23 -10
- package/config/skills/agent/core/remember/execute.sh +129 -22
- package/config/skills/agent/core/report-status/SKILL.md +26 -14
- package/config/skills/agent/core/report-status/execute.sh +139 -25
- package/config/skills/agent/core/send-message/SKILL.md +20 -6
- package/config/skills/agent/core/send-message/execute.sh +90 -8
- package/config/skills/orchestrator/delegate-task/SKILL.md +33 -15
- package/config/skills/orchestrator/delegate-task/execute.sh +69 -15
- package/config/skills/team-leader/delegate-task/SKILL.md +30 -13
- package/config/skills/team-leader/delegate-task/execute.sh +69 -13
- package/dist/backend/backend/src/constants.d.ts +20 -3
- package/dist/backend/backend/src/constants.d.ts.map +1 -1
- package/dist/backend/backend/src/constants.js +21 -4
- package/dist/backend/backend/src/constants.js.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts +7 -9
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js +28 -17
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js +38 -19
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -1
- package/dist/backend/backend/src/services/session/session-command-helper.d.ts.map +1 -1
- package/dist/backend/backend/src/services/session/session-command-helper.js +13 -0
- package/dist/backend/backend/src/services/session/session-command-helper.js.map +1 -1
- package/dist/cli/backend/src/constants.d.ts +20 -3
- package/dist/cli/backend/src/constants.d.ts.map +1 -1
- package/dist/cli/backend/src/constants.js +21 -4
- package/dist/cli/backend/src/constants.js.map +1 -1
- package/frontend/dist/assets/{index-371b68d4.css → index-a2db8a73.css} +1 -1
- package/frontend/dist/assets/{index-506f70da.js → index-d516a3cd.js} +147 -147
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -285,9 +285,14 @@ def main():
|
|
|
285
285
|
}))
|
|
286
286
|
sys.exit(1)
|
|
287
287
|
|
|
288
|
-
#
|
|
288
|
+
# Connect to Chrome via CDP on the specified port.
|
|
289
|
+
# For custom ports, connect directly. For default port (9222), fall back to
|
|
290
|
+
# ensure_chrome_running() which can auto-launch Chrome if needed.
|
|
289
291
|
try:
|
|
290
|
-
|
|
292
|
+
if args.cdp_port != CDP_PORT:
|
|
293
|
+
ws_url = get_ws_url(args.cdp_port)
|
|
294
|
+
else:
|
|
295
|
+
ws_url = ensure_chrome_running()
|
|
291
296
|
except Exception as e:
|
|
292
297
|
print(json.dumps({"success": False, "error": f"chrome_launch_failed: {e}"}))
|
|
293
298
|
sys.exit(1)
|
|
@@ -42,18 +42,31 @@ Retrieve stored memories relevant to a given context or query. Use this to look
|
|
|
42
42
|
|
|
43
43
|
## Parameters
|
|
44
44
|
|
|
45
|
-
|
|
|
46
|
-
|
|
47
|
-
| `agentId` | Yes | Your agent ID |
|
|
48
|
-
| `context` | Yes | Search
|
|
49
|
-
| `scope` | No | Filter
|
|
50
|
-
| `limit` | No |
|
|
51
|
-
| `projectPath` | No | Filter by project path |
|
|
45
|
+
| Flag | JSON Field | Required | Description |
|
|
46
|
+
|------|-----------|----------|-------------|
|
|
47
|
+
| `--agent` / `-a` | `agentId` | Yes | Your agent ID / session name |
|
|
48
|
+
| `--context` / `-c` | `context` | Yes | Search query (or pipe via stdin) |
|
|
49
|
+
| `--scope` / `-s` | `scope` | No | Filter: `project`, `team`, or `global` |
|
|
50
|
+
| `--limit` / `-l` | `limit` | No | Max number of results |
|
|
51
|
+
| `--project` / `-p` | `projectPath` | No | Filter by project path |
|
|
52
52
|
|
|
53
|
-
##
|
|
53
|
+
## Examples — CLI Flags (preferred)
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
|
|
56
|
+
# Search project memory
|
|
57
|
+
bash execute.sh --agent dev-1 --context "authentication implementation patterns" --scope project --project /projects/app
|
|
58
|
+
|
|
59
|
+
# Quick recall with limit
|
|
60
|
+
bash execute.sh --agent dev-1 --context "deployment process" --limit 5
|
|
61
|
+
|
|
62
|
+
# Context via stdin
|
|
63
|
+
echo "how does the relay service work" | bash execute.sh --agent dev-1 --project /projects/app
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Examples — Legacy JSON (backward compatible)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bash execute.sh '{"agentId":"dev-1","context":"authentication patterns","scope":"project","limit":5}'
|
|
57
70
|
```
|
|
58
71
|
|
|
59
72
|
## Output
|
|
@@ -1,24 +1,101 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Retrieve stored memories relevant to a given context
|
|
2
|
+
# Retrieve stored memories relevant to a given context.
|
|
3
|
+
# Supports CLI flags (preferred) and legacy JSON.
|
|
3
4
|
set -euo pipefail
|
|
4
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
6
|
source "${SCRIPT_DIR}/../../_common/lib.sh"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
INPUT_JSON=""
|
|
9
|
+
AGENT_ID=""
|
|
10
|
+
CONTEXT=""
|
|
11
|
+
SCOPE=""
|
|
12
|
+
LIMIT=""
|
|
13
|
+
PROJECT_PATH=""
|
|
14
|
+
|
|
15
|
+
# Detect legacy JSON argument
|
|
16
|
+
if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
|
|
17
|
+
INPUT_JSON="$1"
|
|
18
|
+
shift || true
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
while [[ $# -gt 0 ]]; do
|
|
22
|
+
case "$1" in
|
|
23
|
+
--agent|-a)
|
|
24
|
+
AGENT_ID="$2"
|
|
25
|
+
shift 2
|
|
26
|
+
;;
|
|
27
|
+
--context|-c)
|
|
28
|
+
CONTEXT="$2"
|
|
29
|
+
shift 2
|
|
30
|
+
;;
|
|
31
|
+
--scope|-s)
|
|
32
|
+
SCOPE="$2"
|
|
33
|
+
shift 2
|
|
34
|
+
;;
|
|
35
|
+
--limit|-l)
|
|
36
|
+
LIMIT="$2"
|
|
37
|
+
shift 2
|
|
38
|
+
;;
|
|
39
|
+
--project|-p)
|
|
40
|
+
PROJECT_PATH="$2"
|
|
41
|
+
shift 2
|
|
42
|
+
;;
|
|
43
|
+
--json|-j)
|
|
44
|
+
INPUT_JSON="$2"
|
|
45
|
+
shift 2
|
|
46
|
+
;;
|
|
47
|
+
--help|-h)
|
|
48
|
+
echo "Usage: execute.sh --agent dev-1 --context 'topic to recall' --project /path [--scope project|agent] [--limit 10]"
|
|
49
|
+
exit 0
|
|
50
|
+
;;
|
|
51
|
+
--)
|
|
52
|
+
shift
|
|
53
|
+
break
|
|
54
|
+
;;
|
|
55
|
+
*)
|
|
56
|
+
if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then
|
|
57
|
+
INPUT_JSON="$1"
|
|
58
|
+
shift
|
|
59
|
+
else
|
|
60
|
+
error_exit "Unknown argument: $1"
|
|
61
|
+
fi
|
|
62
|
+
;;
|
|
63
|
+
esac
|
|
64
|
+
done
|
|
65
|
+
|
|
66
|
+
# Read from stdin if no context yet
|
|
67
|
+
if [ -z "$INPUT_JSON" ] && [ -z "$CONTEXT" ] && [ ! -t 0 ]; then
|
|
68
|
+
STDIN_DATA="$(cat)"
|
|
69
|
+
if [[ ${STDIN_DATA:0:1} == '{' ]]; then
|
|
70
|
+
INPUT_JSON="$STDIN_DATA"
|
|
71
|
+
else
|
|
72
|
+
CONTEXT="$STDIN_DATA"
|
|
73
|
+
fi
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# Parse JSON if provided
|
|
77
|
+
if [ -n "$INPUT_JSON" ]; then
|
|
78
|
+
INPUT=$(read_json_input "$INPUT_JSON")
|
|
79
|
+
[ -z "$AGENT_ID" ] && AGENT_ID=$(printf '%s' "$INPUT" | jq -r '.agentId // empty')
|
|
80
|
+
[ -z "$CONTEXT" ] && CONTEXT=$(printf '%s' "$INPUT" | jq -r '.context // empty')
|
|
81
|
+
[ -z "$SCOPE" ] && SCOPE=$(printf '%s' "$INPUT" | jq -r '.scope // empty')
|
|
82
|
+
[ -z "$LIMIT" ] && LIMIT=$(printf '%s' "$INPUT" | jq -r '.limit // empty')
|
|
83
|
+
[ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
require_param "agentId (--agent)" "$AGENT_ID"
|
|
87
|
+
require_param "context (--context)" "$CONTEXT"
|
|
88
|
+
|
|
89
|
+
# Build body using env vars for safe escaping
|
|
90
|
+
export _RCL_AGENT="$AGENT_ID"
|
|
91
|
+
export _RCL_CTX="$CONTEXT"
|
|
92
|
+
|
|
93
|
+
BODY=$(jq -n '{agentId: env._RCL_AGENT, context: env._RCL_CTX}')
|
|
94
|
+
|
|
95
|
+
[ -n "$SCOPE" ] && BODY=$(echo "$BODY" | jq --arg s "$SCOPE" '. + {scope: $s}')
|
|
96
|
+
[ -n "$LIMIT" ] && BODY=$(echo "$BODY" | jq --arg l "$LIMIT" '. + {limit: ($l | tonumber)}')
|
|
97
|
+
[ -n "$PROJECT_PATH" ] && BODY=$(echo "$BODY" | jq --arg p "$PROJECT_PATH" '. + {projectPath: $p}')
|
|
98
|
+
|
|
99
|
+
unset _RCL_AGENT _RCL_CTX
|
|
23
100
|
|
|
24
101
|
api_call POST "/memory/recall" "$BODY"
|
|
@@ -42,19 +42,31 @@ Record a learning or insight gained during task execution. These learnings are s
|
|
|
42
42
|
|
|
43
43
|
## Parameters
|
|
44
44
|
|
|
45
|
-
|
|
|
46
|
-
|
|
47
|
-
| `agentId` | Yes | Your agent ID |
|
|
48
|
-
| `agentRole` | Yes | Your role (e.g., `
|
|
49
|
-
| `projectPath` | Yes | Absolute path to the project |
|
|
50
|
-
| `learning` | Yes |
|
|
51
|
-
| `
|
|
52
|
-
| `relatedFiles` | No | Array of file paths related to the learning |
|
|
45
|
+
| Flag | JSON Field | Required | Description |
|
|
46
|
+
|------|-----------|----------|-------------|
|
|
47
|
+
| `--agent` / `-a` | `agentId` | Yes | Your agent ID / session name |
|
|
48
|
+
| `--role` / `-r` | `agentRole` | Yes | Your role (e.g., `developer`, `qa`) |
|
|
49
|
+
| `--project` / `-p` | `projectPath` | Yes | Absolute path to the project |
|
|
50
|
+
| `--learning` / `-l` | `learning` | Yes | The learning or insight (or pipe via stdin) |
|
|
51
|
+
| `--learning-file` | — | No | Read learning from a file path |
|
|
53
52
|
|
|
54
|
-
##
|
|
53
|
+
## Examples — CLI Flags (preferred)
|
|
55
54
|
|
|
56
55
|
```bash
|
|
57
|
-
|
|
56
|
+
# Record a learning
|
|
57
|
+
bash execute.sh --agent dev-1 --role developer --project /projects/app --learning "Jest mock resets are required between tests"
|
|
58
|
+
|
|
59
|
+
# Learning via stdin (for text with special characters)
|
|
60
|
+
echo "Don't use git add -A — it catches .env files" | bash execute.sh --agent dev-1 --role developer --project /projects/app
|
|
61
|
+
|
|
62
|
+
# Learning from file
|
|
63
|
+
bash execute.sh --agent dev-1 --role developer --project /projects/app --learning-file /tmp/insight.txt
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Examples — Legacy JSON (backward compatible)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bash execute.sh '{"agentId":"dev-1","agentRole":"developer","projectPath":"/projects/app","learning":"Jest mock resets are required between tests"}'
|
|
58
70
|
```
|
|
59
71
|
|
|
60
72
|
## Output
|
|
@@ -1,29 +1,98 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Record a learning or insight for team knowledge sharing
|
|
2
|
+
# Record a learning or insight for team knowledge sharing.
|
|
3
|
+
# Supports CLI flags (preferred) and legacy JSON.
|
|
3
4
|
set -euo pipefail
|
|
4
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
6
|
source "${SCRIPT_DIR}/../../_common/lib.sh"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
INPUT_JSON=""
|
|
9
|
+
AGENT_ID=""
|
|
10
|
+
AGENT_ROLE=""
|
|
11
|
+
PROJECT_PATH=""
|
|
12
|
+
LEARNING=""
|
|
13
|
+
|
|
14
|
+
# Detect legacy JSON argument
|
|
15
|
+
if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
|
|
16
|
+
INPUT_JSON="$1"
|
|
17
|
+
shift || true
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
while [[ $# -gt 0 ]]; do
|
|
21
|
+
case "$1" in
|
|
22
|
+
--agent|-a)
|
|
23
|
+
AGENT_ID="$2"
|
|
24
|
+
shift 2
|
|
25
|
+
;;
|
|
26
|
+
--role|-r)
|
|
27
|
+
AGENT_ROLE="$2"
|
|
28
|
+
shift 2
|
|
29
|
+
;;
|
|
30
|
+
--project|-p)
|
|
31
|
+
PROJECT_PATH="$2"
|
|
32
|
+
shift 2
|
|
33
|
+
;;
|
|
34
|
+
--learning|-l)
|
|
35
|
+
LEARNING="$2"
|
|
36
|
+
shift 2
|
|
37
|
+
;;
|
|
38
|
+
--learning-file)
|
|
39
|
+
LEARNING="$(cat "$2")"
|
|
40
|
+
shift 2
|
|
41
|
+
;;
|
|
42
|
+
--json|-j)
|
|
43
|
+
INPUT_JSON="$2"
|
|
44
|
+
shift 2
|
|
45
|
+
;;
|
|
46
|
+
--help|-h)
|
|
47
|
+
echo "Usage: execute.sh --agent dev-1 --role developer --project /path --learning 'What I learned'"
|
|
48
|
+
exit 0
|
|
49
|
+
;;
|
|
50
|
+
--)
|
|
51
|
+
shift
|
|
52
|
+
break
|
|
53
|
+
;;
|
|
54
|
+
*)
|
|
55
|
+
if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then
|
|
56
|
+
INPUT_JSON="$1"
|
|
57
|
+
shift
|
|
58
|
+
else
|
|
59
|
+
error_exit "Unknown argument: $1"
|
|
60
|
+
fi
|
|
61
|
+
;;
|
|
62
|
+
esac
|
|
63
|
+
done
|
|
64
|
+
|
|
65
|
+
# Read from stdin if no learning yet
|
|
66
|
+
if [ -z "$INPUT_JSON" ] && [ -z "$LEARNING" ] && [ ! -t 0 ]; then
|
|
67
|
+
STDIN_DATA="$(cat)"
|
|
68
|
+
if [[ ${STDIN_DATA:0:1} == '{' ]]; then
|
|
69
|
+
INPUT_JSON="$STDIN_DATA"
|
|
70
|
+
else
|
|
71
|
+
LEARNING="$STDIN_DATA"
|
|
72
|
+
fi
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
# Parse JSON if provided
|
|
76
|
+
if [ -n "$INPUT_JSON" ]; then
|
|
77
|
+
INPUT=$(read_json_input "$INPUT_JSON")
|
|
78
|
+
[ -z "$AGENT_ID" ] && AGENT_ID=$(printf '%s' "$INPUT" | jq -r '.agentId // empty')
|
|
79
|
+
[ -z "$AGENT_ROLE" ] && AGENT_ROLE=$(printf '%s' "$INPUT" | jq -r '.agentRole // empty')
|
|
80
|
+
[ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
81
|
+
[ -z "$LEARNING" ] && LEARNING=$(printf '%s' "$INPUT" | jq -r '.learning // empty')
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
require_param "agentId (--agent)" "$AGENT_ID"
|
|
85
|
+
require_param "agentRole (--role)" "$AGENT_ROLE"
|
|
86
|
+
require_param "projectPath (--project)" "$PROJECT_PATH"
|
|
87
|
+
require_param "learning (--learning)" "$LEARNING"
|
|
88
|
+
|
|
89
|
+
# Build body using env vars for safe escaping
|
|
90
|
+
export _LRN_AGENT="$AGENT_ID"
|
|
91
|
+
export _LRN_ROLE="$AGENT_ROLE"
|
|
92
|
+
export _LRN_PROJECT="$PROJECT_PATH"
|
|
93
|
+
export _LRN_CONTENT="$LEARNING"
|
|
94
|
+
|
|
95
|
+
BODY=$(jq -n '{agentId: env._LRN_AGENT, agentRole: env._LRN_ROLE, projectPath: env._LRN_PROJECT, learning: env._LRN_CONTENT}')
|
|
96
|
+
unset _LRN_AGENT _LRN_ROLE _LRN_PROJECT _LRN_CONTENT
|
|
28
97
|
|
|
29
98
|
api_call POST "/memory/record-learning" "$BODY"
|
|
@@ -41,19 +41,32 @@ Store a memory entry for future recall. Use this to persist important context, d
|
|
|
41
41
|
|
|
42
42
|
## Parameters
|
|
43
43
|
|
|
44
|
-
|
|
|
45
|
-
|
|
46
|
-
| `agentId` | Yes | Your agent ID |
|
|
47
|
-
| `content` | Yes |
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
44
|
+
| Flag | JSON Field | Required | Description |
|
|
45
|
+
|------|-----------|----------|-------------|
|
|
46
|
+
| `--agent` / `-a` | `agentId` | Yes | Your agent ID / session name |
|
|
47
|
+
| `--content` / `-c` | `content` | Yes | Content to remember (or pipe via stdin) |
|
|
48
|
+
| `--content-file` | — | No | Read content from a file path |
|
|
49
|
+
| `--category` / `-C` | `category` | Yes | Category: `pattern`, `decision`, `gotcha`, `fact`, `preference`, `relationship`, `user_preference` |
|
|
50
|
+
| `--scope` / `-s` | `scope` | Yes | Scope: `agent` or `project` |
|
|
51
|
+
| `--project` / `-p` | `projectPath` | No | Project path (required for `project` scope) |
|
|
52
52
|
|
|
53
|
-
##
|
|
53
|
+
## Examples — CLI Flags (preferred)
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
|
|
56
|
+
# Store a project-wide pattern
|
|
57
|
+
bash execute.sh --agent dev-1 --content "User prefers PDF delivery in Slack thread" --category user_preference --scope project --project /projects/app
|
|
58
|
+
|
|
59
|
+
# Content via stdin (for text with special characters)
|
|
60
|
+
echo "Jest mock resets are required between tests — don't forget" | bash execute.sh --agent dev-1 --category gotcha --scope project --project /projects/app
|
|
61
|
+
|
|
62
|
+
# Content from file
|
|
63
|
+
bash execute.sh --agent dev-1 --content-file /tmp/finding.txt --category decision --scope project --project /projects/app
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Examples — Legacy JSON (backward compatible)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bash execute.sh '{"agentId":"dev-1","content":"User prefers PDF delivery","category":"user_preference","scope":"project","projectPath":"/projects/app"}'
|
|
57
70
|
```
|
|
58
71
|
|
|
59
72
|
## Output
|
|
@@ -1,35 +1,142 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# Store a memory entry for future recall
|
|
2
|
+
# Store a memory entry for future recall.
|
|
3
|
+
# Supports CLI flags (preferred) and legacy JSON.
|
|
3
4
|
set -euo pipefail
|
|
4
5
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
6
|
source "${SCRIPT_DIR}/../../_common/lib.sh"
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
print_usage() {
|
|
9
|
+
cat <<'EOF_USAGE'
|
|
10
|
+
Usage:
|
|
11
|
+
# CLI flags (preferred)
|
|
12
|
+
bash execute.sh --agent dev-1 --content "Important finding" --category pattern --scope project --project /path
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
# Content from stdin
|
|
15
|
+
echo "Multi-line finding" | bash execute.sh --agent dev-1 --category pattern --scope project --project /path
|
|
16
|
+
|
|
17
|
+
# Content from file
|
|
18
|
+
bash execute.sh --agent dev-1 --content-file /tmp/finding.txt --category pattern --scope project
|
|
19
|
+
|
|
20
|
+
# Legacy JSON (backward compatible)
|
|
21
|
+
bash execute.sh '{"agentId":"dev-1","content":"...","category":"pattern","scope":"project"}'
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--agent | -a Agent ID / session name (required)
|
|
25
|
+
--content | -c Memory content text (required unless piped via stdin)
|
|
26
|
+
--content-file Read content from file path
|
|
27
|
+
--category | -C Category: pattern, decision, gotcha, fact, preference (required)
|
|
28
|
+
--scope | -s Scope: project or agent (required)
|
|
29
|
+
--project | -p Project path (required for project scope)
|
|
30
|
+
--json | -j Raw JSON payload
|
|
31
|
+
--help | -h Show this help
|
|
32
|
+
EOF_USAGE
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
INPUT_JSON=""
|
|
36
|
+
AGENT_ID=""
|
|
37
|
+
CONTENT=""
|
|
38
|
+
CATEGORY=""
|
|
39
|
+
SCOPE=""
|
|
40
|
+
PROJECT_PATH=""
|
|
41
|
+
|
|
42
|
+
# Detect legacy JSON argument
|
|
43
|
+
if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
|
|
44
|
+
INPUT_JSON="$1"
|
|
45
|
+
shift || true
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
while [[ $# -gt 0 ]]; do
|
|
49
|
+
case "$1" in
|
|
50
|
+
--agent|-a)
|
|
51
|
+
AGENT_ID="$2"
|
|
52
|
+
shift 2
|
|
53
|
+
;;
|
|
54
|
+
--content|-c)
|
|
55
|
+
CONTENT="$2"
|
|
56
|
+
shift 2
|
|
57
|
+
;;
|
|
58
|
+
--content-file)
|
|
59
|
+
CONTENT="$(cat "$2")"
|
|
60
|
+
shift 2
|
|
61
|
+
;;
|
|
62
|
+
--category|-C)
|
|
63
|
+
CATEGORY="$2"
|
|
64
|
+
shift 2
|
|
65
|
+
;;
|
|
66
|
+
--scope|-s)
|
|
67
|
+
SCOPE="$2"
|
|
68
|
+
shift 2
|
|
69
|
+
;;
|
|
70
|
+
--project|-p)
|
|
71
|
+
PROJECT_PATH="$2"
|
|
72
|
+
shift 2
|
|
73
|
+
;;
|
|
74
|
+
--json|-j)
|
|
75
|
+
INPUT_JSON="$2"
|
|
76
|
+
shift 2
|
|
77
|
+
;;
|
|
78
|
+
--help|-h)
|
|
79
|
+
print_usage
|
|
80
|
+
exit 0
|
|
81
|
+
;;
|
|
82
|
+
--)
|
|
83
|
+
shift
|
|
84
|
+
break
|
|
85
|
+
;;
|
|
86
|
+
*)
|
|
87
|
+
if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then
|
|
88
|
+
INPUT_JSON="$1"
|
|
89
|
+
shift
|
|
90
|
+
else
|
|
91
|
+
error_exit "Unknown argument: $1. Use --help for usage."
|
|
92
|
+
fi
|
|
93
|
+
;;
|
|
94
|
+
esac
|
|
95
|
+
done
|
|
96
|
+
|
|
97
|
+
# Read from stdin if no content yet
|
|
98
|
+
if [ -z "$INPUT_JSON" ] && [ -z "$CONTENT" ] && [ ! -t 0 ]; then
|
|
99
|
+
STDIN_DATA="$(cat)"
|
|
100
|
+
if [[ ${STDIN_DATA:0:1} == '{' ]]; then
|
|
101
|
+
INPUT_JSON="$STDIN_DATA"
|
|
102
|
+
else
|
|
103
|
+
CONTENT="$STDIN_DATA"
|
|
104
|
+
fi
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# Parse JSON if provided
|
|
108
|
+
if [ -n "$INPUT_JSON" ]; then
|
|
109
|
+
INPUT=$(read_json_input "$INPUT_JSON")
|
|
110
|
+
[ -z "$AGENT_ID" ] && AGENT_ID=$(printf '%s' "$INPUT" | jq -r '.agentId // empty')
|
|
111
|
+
[ -z "$CONTENT" ] && CONTENT=$(printf '%s' "$INPUT" | jq -r '.content // empty')
|
|
112
|
+
[ -z "$CATEGORY" ] && CATEGORY=$(printf '%s' "$INPUT" | jq -r '.category // empty')
|
|
113
|
+
[ -z "$SCOPE" ] && SCOPE=$(printf '%s' "$INPUT" | jq -r '.scope // empty')
|
|
114
|
+
[ -z "$PROJECT_PATH" ] && PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
require_param "agentId (--agent)" "$AGENT_ID"
|
|
118
|
+
require_param "content (--content)" "$CONTENT"
|
|
119
|
+
require_param "category (--category)" "$CATEGORY"
|
|
120
|
+
require_param "scope (--scope)" "$SCOPE"
|
|
18
121
|
|
|
19
122
|
# #187: Auto-inject projectPath from CREWLY_PROJECT_PATH env var when not provided
|
|
20
|
-
PROJECT_PATH=$(printf '%s' "$INPUT" | jq -r '.projectPath // empty')
|
|
21
123
|
if [ -z "$PROJECT_PATH" ] && [ -n "${CREWLY_PROJECT_PATH:-}" ]; then
|
|
22
|
-
|
|
124
|
+
PROJECT_PATH="$CREWLY_PROJECT_PATH"
|
|
23
125
|
fi
|
|
24
126
|
|
|
25
|
-
# Build body
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(
|
|
127
|
+
# Build body using env vars to safely handle special characters
|
|
128
|
+
export _MEM_AGENT="$AGENT_ID"
|
|
129
|
+
export _MEM_CONTENT="$CONTENT"
|
|
130
|
+
export _MEM_CATEGORY="$CATEGORY"
|
|
131
|
+
export _MEM_SCOPE="$SCOPE"
|
|
132
|
+
|
|
133
|
+
if [ -n "$PROJECT_PATH" ]; then
|
|
134
|
+
export _MEM_PROJECT="$PROJECT_PATH"
|
|
135
|
+
BODY=$(jq -n '{agentId: env._MEM_AGENT, content: env._MEM_CONTENT, category: env._MEM_CATEGORY, scope: env._MEM_SCOPE, projectPath: env._MEM_PROJECT}')
|
|
136
|
+
unset _MEM_PROJECT
|
|
137
|
+
else
|
|
138
|
+
BODY=$(jq -n '{agentId: env._MEM_AGENT, content: env._MEM_CONTENT, category: env._MEM_CATEGORY, scope: env._MEM_SCOPE}')
|
|
139
|
+
fi
|
|
140
|
+
unset _MEM_AGENT _MEM_CONTENT _MEM_CATEGORY _MEM_SCOPE
|
|
34
141
|
|
|
35
142
|
api_call POST "/memory/remember" "$BODY"
|
|
@@ -45,29 +45,41 @@ When `status` is `done` and a `taskPath` is provided, the task file is automatic
|
|
|
45
45
|
|
|
46
46
|
## Parameters
|
|
47
47
|
|
|
48
|
-
|
|
|
49
|
-
|
|
50
|
-
| `sessionName` | Yes | Your agent session name |
|
|
51
|
-
| `status` | Yes |
|
|
52
|
-
| `summary` | Yes | Brief description
|
|
53
|
-
| `
|
|
48
|
+
| Flag | JSON Field | Required | Description |
|
|
49
|
+
|------|-----------|----------|-------------|
|
|
50
|
+
| `--session` / `-s` | `sessionName` | Yes | Your agent session name |
|
|
51
|
+
| `--status` / `-S` | `status` | Yes | Status: `done`, `blocked`, `failed`, `in_progress`, `active` |
|
|
52
|
+
| `--summary` / `-m` | `summary` | Yes | Brief description (or pipe via stdin) |
|
|
53
|
+
| `--summary-file` | — | No | Read summary from a file path |
|
|
54
|
+
| `--project` / `-p` | `projectPath` | No | Project path for auto-remember on completion |
|
|
55
|
+
| `--task-path` | `taskPath` | No | Task file path; auto-moves to `done/` on completion |
|
|
56
|
+
| `--task-id` | `taskId` | No | Task ID (for structured StatusReport format) |
|
|
57
|
+
| `--progress` | `progress` | No | Progress percentage 0-100 |
|
|
58
|
+
| `--structured` | `structured` | No | Use structured StatusReport format |
|
|
54
59
|
|
|
55
|
-
##
|
|
60
|
+
## Examples — CLI Flags (preferred)
|
|
56
61
|
|
|
57
62
|
```bash
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
# Report done
|
|
64
|
+
bash execute.sh --session dev-1 --status done --summary "Finished auth module, all tests pass" --project /path/to/project
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
# Report a blocker
|
|
67
|
+
bash execute.sh --session dev-1 --status blocked --summary "Waiting on API credentials from ops team"
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
bash
|
|
69
|
+
# Report failure
|
|
70
|
+
bash execute.sh --session dev-1 --status failed --summary "Build fails due to missing dependency"
|
|
71
|
+
|
|
72
|
+
# Multi-line summary via stdin (avoids shell escaping)
|
|
73
|
+
echo "Fixed the bug — it's working now" | bash execute.sh --session dev-1 --status done --project /path
|
|
74
|
+
|
|
75
|
+
# Summary from file
|
|
76
|
+
bash execute.sh --session dev-1 --status done --summary-file /tmp/summary.txt --project /path
|
|
65
77
|
```
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
## Examples — Legacy JSON (backward compatible)
|
|
68
80
|
|
|
69
81
|
```bash
|
|
70
|
-
bash
|
|
82
|
+
bash execute.sh '{"sessionName":"dev-1","status":"done","summary":"Finished implementing auth module","taskPath":"/path/.crewly/tasks/delegated/in_progress/implement_auth_1234.md"}'
|
|
71
83
|
```
|
|
72
84
|
|
|
73
85
|
## Output
|