@soleri/cli 1.0.1 → 1.0.3
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/dist/hooks/templates.js +59 -1
- package/dist/hooks/templates.js.map +1 -1
- package/dist/main.js +0 -0
- package/package.json +2 -2
- package/src/__tests__/create.test.ts +9 -7
- package/src/hooks/templates.ts +62 -1
package/dist/hooks/templates.js
CHANGED
|
@@ -17,11 +17,69 @@ function getAgentMeta(dir) {
|
|
|
17
17
|
return { agentId: sanitizeId(ctx.agentId), packageName: ctx.packageName };
|
|
18
18
|
}
|
|
19
19
|
// ── Claude Code ──
|
|
20
|
+
/**
|
|
21
|
+
* Build the UserPromptSubmit hook script for auto-routing mode detection.
|
|
22
|
+
*
|
|
23
|
+
* Logic is "skip non-work, then classify":
|
|
24
|
+
* 1. Skip: empty/short, questions, git ops, acknowledgements, greetings
|
|
25
|
+
* 2. Try keyword match → specific mode (FIX, BUILD, etc.)
|
|
26
|
+
* 3. No keyword match → fall back to GENERAL-MODE
|
|
27
|
+
*
|
|
28
|
+
* This ensures near-100% trigger rate on work tasks while staying
|
|
29
|
+
* silent for conversational / non-actionable prompts.
|
|
30
|
+
*
|
|
31
|
+
* Implementation note: skip filters use `if ...; then exit 0; fi`
|
|
32
|
+
* (self-contained, safe to join with &&). The classification block
|
|
33
|
+
* is a single compound if/elif/fi string to avoid && between
|
|
34
|
+
* `then` and commands (which is a bash syntax error).
|
|
35
|
+
*/
|
|
36
|
+
function buildAutoRouteScript(agentId) {
|
|
37
|
+
const facadeId = agentId.replace(/-/g, '_');
|
|
38
|
+
// Skip filters: each is a self-contained `if ...; then exit 0; fi`
|
|
39
|
+
// so they're safe to join with &&.
|
|
40
|
+
// Classification: one compound if/elif/fi block as a single string.
|
|
41
|
+
const lines = [
|
|
42
|
+
'prompt="$CLAUDE_USER_PROMPT"',
|
|
43
|
+
'if [ ${#prompt} -lt 10 ]; then exit 0; fi',
|
|
44
|
+
'if echo "$prompt" | grep -qiE \'^(how |what |why |where |when |which |is |are |do |does |can |could |should )\'; then exit 0; fi',
|
|
45
|
+
'if echo "$prompt" | grep -qiE \'^(git |commit|push|pull|merge|rebase)\'; then exit 0; fi',
|
|
46
|
+
'if echo "$prompt" | grep -qiE \'^(yes|no|ok|sure|thanks|thank you|sounds good|got it|exactly|correct|right|agreed|lgtm|approve|y|n)$\'; then exit 0; fi',
|
|
47
|
+
'if echo "$prompt" | grep -qiE \'^(hello|hi|hey|hola|adios|goodbye|bye)\'; then exit 0; fi',
|
|
48
|
+
// Classification: single compound block (no && splitting then/commands)
|
|
49
|
+
'mode="GENERAL-MODE"; intent="general"; matched="fallback"',
|
|
50
|
+
[
|
|
51
|
+
'if echo "$prompt" | grep -qiE \'\\b(fix|bug|broken|error|crash|debug|repair|janky|wrong|fail)\\b\'; then mode="FIX-MODE"; intent="fix"; matched="fix/bug/error"',
|
|
52
|
+
'elif echo "$prompt" | grep -qiE \'\\b(build|create|add|implement|scaffold|generate|feature|new|wire|hook up|set up|integrate)\\b\'; then mode="BUILD-MODE"; intent="build"; matched="build/create"',
|
|
53
|
+
'elif echo "$prompt" | grep -qiE \'\\b(refactor|optimize|clean|enhance|simplify|improve|reduce|consolidate|streamline)\\b\'; then mode="IMPROVE-MODE"; intent="improve"; matched="refactor/optimize"',
|
|
54
|
+
'elif echo "$prompt" | grep -qiE \'\\b(deploy|ship|release|publish|package|deliver|launch)\\b\'; then mode="DELIVER-MODE"; intent="deliver"; matched="deploy/ship"',
|
|
55
|
+
'elif echo "$prompt" | grep -qiE \'\\b(review|feedback|critique|assess|evaluate|compare)\\b\'; then mode="REVIEW-MODE"; intent="review"; matched="review/feedback"',
|
|
56
|
+
'elif echo "$prompt" | grep -qiE \'\\b(plan|architect|strategy|roadmap|outline|propose)\\b\'; then mode="PLAN-MODE"; intent="plan"; matched="plan/architect"',
|
|
57
|
+
'elif echo "$prompt" | grep -qiE \'\\b(design|style|layout|color|typography|spacing|visual|theme|ui|ux)\\b\'; then mode="DESIGN-MODE"; intent="design"; matched="design/style"',
|
|
58
|
+
'elif echo "$prompt" | grep -qiE \'\\b(validate|check|verify|test|lint|audit|assert|ensure|confirm)\\b\'; then mode="VALIDATE-MODE"; intent="validate"; matched="validate/test"',
|
|
59
|
+
'elif echo "$prompt" | grep -qiE \'\\b(explore|search|find|show|list|explain|trace|inspect|dump|describe)\\b\'; then mode="EXPLORE-MODE"; intent="explore"; matched="explore/search"',
|
|
60
|
+
'fi',
|
|
61
|
+
].join('; '),
|
|
62
|
+
'echo "[$mode] Detected intent: $intent ($matched)"',
|
|
63
|
+
`echo "Call ${facadeId}_core op:route_intent params:{ prompt: \\"<user message>\\" } to get behavior rules."`,
|
|
64
|
+
];
|
|
65
|
+
return lines.join(' && ');
|
|
66
|
+
}
|
|
20
67
|
function generateClaudeCodeSettings(dir) {
|
|
21
68
|
const meta = getAgentMeta(dir);
|
|
22
69
|
const agentId = meta?.agentId ?? 'my-agent';
|
|
70
|
+
const facadeId = agentId.replace(/-/g, '_');
|
|
23
71
|
const settings = JSON.stringify({
|
|
24
72
|
hooks: {
|
|
73
|
+
UserPromptSubmit: [
|
|
74
|
+
{
|
|
75
|
+
hooks: [
|
|
76
|
+
{
|
|
77
|
+
type: 'command',
|
|
78
|
+
command: buildAutoRouteScript(agentId),
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
25
83
|
PreToolUse: [
|
|
26
84
|
{
|
|
27
85
|
matcher: '*',
|
|
@@ -49,7 +107,7 @@ function generateClaudeCodeSettings(dir) {
|
|
|
49
107
|
hooks: [
|
|
50
108
|
{
|
|
51
109
|
type: 'command',
|
|
52
|
-
command: `echo "[${agentId}] session started"`,
|
|
110
|
+
command: `echo "[${agentId}] session started — register project: ${facadeId}_core op:register params:{ projectPath: \\".\\" }" && echo "Check for active plans: ${facadeId}_core op:get_plan"`,
|
|
53
111
|
},
|
|
54
112
|
],
|
|
55
113
|
},
|
|
@@ -1 +1 @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CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soleri/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Developer CLI for creating and managing Soleri AI agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@clack/prompts": "^1.0.0",
|
|
40
|
-
"@soleri/forge": "^
|
|
40
|
+
"@soleri/forge": "^5.0.0",
|
|
41
41
|
"commander": "^13.0.0"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
@@ -57,15 +57,17 @@ describe('create command', () => {
|
|
|
57
57
|
expect(result.summary).toContain('already exists');
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
it('should create
|
|
60
|
+
it('should not create facade files (v5.0 uses runtime factories from @soleri/core)', () => {
|
|
61
61
|
scaffold(testConfig);
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
);
|
|
63
|
+
// v5.0: facades are created at runtime by createDomainFacades() — no generated files
|
|
64
|
+
expect(existsSync(join(tempDir, 'test-agent', 'src', 'facades'))).toBe(false);
|
|
65
|
+
|
|
66
|
+
// Entry point should reference createDomainFacades
|
|
67
|
+
const entry = readFileSync(join(tempDir, 'test-agent', 'src', 'index.ts'), 'utf-8');
|
|
68
|
+
expect(entry).toContain('createDomainFacades');
|
|
69
|
+
expect(entry).toContain('"testing"');
|
|
70
|
+
expect(entry).toContain('"quality"');
|
|
69
71
|
});
|
|
70
72
|
|
|
71
73
|
it('should create intelligence data files for each domain', () => {
|
package/src/hooks/templates.ts
CHANGED
|
@@ -28,13 +28,74 @@ function getAgentMeta(dir?: string): AgentMeta | null {
|
|
|
28
28
|
|
|
29
29
|
// ── Claude Code ──
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Build the UserPromptSubmit hook script for auto-routing mode detection.
|
|
33
|
+
*
|
|
34
|
+
* Logic is "skip non-work, then classify":
|
|
35
|
+
* 1. Skip: empty/short, questions, git ops, acknowledgements, greetings
|
|
36
|
+
* 2. Try keyword match → specific mode (FIX, BUILD, etc.)
|
|
37
|
+
* 3. No keyword match → fall back to GENERAL-MODE
|
|
38
|
+
*
|
|
39
|
+
* This ensures near-100% trigger rate on work tasks while staying
|
|
40
|
+
* silent for conversational / non-actionable prompts.
|
|
41
|
+
*
|
|
42
|
+
* Implementation note: skip filters use `if ...; then exit 0; fi`
|
|
43
|
+
* (self-contained, safe to join with &&). The classification block
|
|
44
|
+
* is a single compound if/elif/fi string to avoid && between
|
|
45
|
+
* `then` and commands (which is a bash syntax error).
|
|
46
|
+
*/
|
|
47
|
+
function buildAutoRouteScript(agentId: string): string {
|
|
48
|
+
const facadeId = agentId.replace(/-/g, '_');
|
|
49
|
+
|
|
50
|
+
// Skip filters: each is a self-contained `if ...; then exit 0; fi`
|
|
51
|
+
// so they're safe to join with &&.
|
|
52
|
+
// Classification: one compound if/elif/fi block as a single string.
|
|
53
|
+
const lines = [
|
|
54
|
+
'prompt="$CLAUDE_USER_PROMPT"',
|
|
55
|
+
'if [ ${#prompt} -lt 10 ]; then exit 0; fi',
|
|
56
|
+
'if echo "$prompt" | grep -qiE \'^(how |what |why |where |when |which |is |are |do |does |can |could |should )\'; then exit 0; fi',
|
|
57
|
+
'if echo "$prompt" | grep -qiE \'^(git |commit|push|pull|merge|rebase)\'; then exit 0; fi',
|
|
58
|
+
'if echo "$prompt" | grep -qiE \'^(yes|no|ok|sure|thanks|thank you|sounds good|got it|exactly|correct|right|agreed|lgtm|approve|y|n)$\'; then exit 0; fi',
|
|
59
|
+
'if echo "$prompt" | grep -qiE \'^(hello|hi|hey|hola|adios|goodbye|bye)\'; then exit 0; fi',
|
|
60
|
+
// Classification: single compound block (no && splitting then/commands)
|
|
61
|
+
'mode="GENERAL-MODE"; intent="general"; matched="fallback"',
|
|
62
|
+
[
|
|
63
|
+
'if echo "$prompt" | grep -qiE \'\\b(fix|bug|broken|error|crash|debug|repair|janky|wrong|fail)\\b\'; then mode="FIX-MODE"; intent="fix"; matched="fix/bug/error"',
|
|
64
|
+
'elif echo "$prompt" | grep -qiE \'\\b(build|create|add|implement|scaffold|generate|feature|new|wire|hook up|set up|integrate)\\b\'; then mode="BUILD-MODE"; intent="build"; matched="build/create"',
|
|
65
|
+
'elif echo "$prompt" | grep -qiE \'\\b(refactor|optimize|clean|enhance|simplify|improve|reduce|consolidate|streamline)\\b\'; then mode="IMPROVE-MODE"; intent="improve"; matched="refactor/optimize"',
|
|
66
|
+
'elif echo "$prompt" | grep -qiE \'\\b(deploy|ship|release|publish|package|deliver|launch)\\b\'; then mode="DELIVER-MODE"; intent="deliver"; matched="deploy/ship"',
|
|
67
|
+
'elif echo "$prompt" | grep -qiE \'\\b(review|feedback|critique|assess|evaluate|compare)\\b\'; then mode="REVIEW-MODE"; intent="review"; matched="review/feedback"',
|
|
68
|
+
'elif echo "$prompt" | grep -qiE \'\\b(plan|architect|strategy|roadmap|outline|propose)\\b\'; then mode="PLAN-MODE"; intent="plan"; matched="plan/architect"',
|
|
69
|
+
'elif echo "$prompt" | grep -qiE \'\\b(design|style|layout|color|typography|spacing|visual|theme|ui|ux)\\b\'; then mode="DESIGN-MODE"; intent="design"; matched="design/style"',
|
|
70
|
+
'elif echo "$prompt" | grep -qiE \'\\b(validate|check|verify|test|lint|audit|assert|ensure|confirm)\\b\'; then mode="VALIDATE-MODE"; intent="validate"; matched="validate/test"',
|
|
71
|
+
'elif echo "$prompt" | grep -qiE \'\\b(explore|search|find|show|list|explain|trace|inspect|dump|describe)\\b\'; then mode="EXPLORE-MODE"; intent="explore"; matched="explore/search"',
|
|
72
|
+
'fi',
|
|
73
|
+
].join('; '),
|
|
74
|
+
'echo "[$mode] Detected intent: $intent ($matched)"',
|
|
75
|
+
`echo "Call ${facadeId}_core op:route_intent params:{ prompt: \\"<user message>\\" } to get behavior rules."`,
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
return lines.join(' && ');
|
|
79
|
+
}
|
|
80
|
+
|
|
31
81
|
function generateClaudeCodeSettings(dir?: string): Record<string, string> {
|
|
32
82
|
const meta = getAgentMeta(dir);
|
|
33
83
|
const agentId = meta?.agentId ?? 'my-agent';
|
|
84
|
+
const facadeId = agentId.replace(/-/g, '_');
|
|
34
85
|
|
|
35
86
|
const settings = JSON.stringify(
|
|
36
87
|
{
|
|
37
88
|
hooks: {
|
|
89
|
+
UserPromptSubmit: [
|
|
90
|
+
{
|
|
91
|
+
hooks: [
|
|
92
|
+
{
|
|
93
|
+
type: 'command',
|
|
94
|
+
command: buildAutoRouteScript(agentId),
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
],
|
|
38
99
|
PreToolUse: [
|
|
39
100
|
{
|
|
40
101
|
matcher: '*',
|
|
@@ -62,7 +123,7 @@ function generateClaudeCodeSettings(dir?: string): Record<string, string> {
|
|
|
62
123
|
hooks: [
|
|
63
124
|
{
|
|
64
125
|
type: 'command',
|
|
65
|
-
command: `echo "[${agentId}] session started"`,
|
|
126
|
+
command: `echo "[${agentId}] session started — register project: ${facadeId}_core op:register params:{ projectPath: \\".\\" }" && echo "Check for active plans: ${facadeId}_core op:get_plan"`,
|
|
66
127
|
},
|
|
67
128
|
],
|
|
68
129
|
},
|