@powerhousedao/ph-clint-cli 0.1.0-dev.22 → 0.1.0-dev.24
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/cli.js +22 -3
- package/dist/codegen/builders/agent-ts.d.ts +4 -4
- package/dist/codegen/builders/agent-ts.js +83 -2
- package/dist/codegen/builders/cli-package-json.js +1 -0
- package/dist/codegen/builders/cli-ts.js +34 -5
- package/dist/codegen/builders/demo-agent-ts.d.ts +8 -0
- package/dist/codegen/builders/demo-agent-ts.js +44 -0
- package/dist/codegen/builders/framework-ts.js +12 -6
- package/dist/codegen/builders/index.d.ts +7 -1
- package/dist/codegen/builders/index.js +25 -4
- package/dist/codegen/builders/mastra-index-ts.d.ts +3 -0
- package/dist/codegen/builders/mastra-index-ts.js +47 -5
- package/dist/codegen/index.js +3 -2
- package/dist/commands/clint-project-init.d.ts +11 -0
- package/dist/commands/clint-project-init.js +10 -1
- package/dist/gen/agent-profiles/PhClintDevAgent.md +13 -0
- package/dist/gen/skills/cli-setup/.cli-docs.md +135 -0
- package/dist/gen/skills/cli-setup/SKILL.md +125 -0
- package/dist/gen/skills/cli-setup/references/00.assess-cli-needs.md +53 -0
- package/dist/gen/skills/cli-setup/references/01.define-config-schema.md +78 -0
- package/dist/gen/skills/cli-setup/references/02.wire-cli.md +141 -0
- package/dist/gen/skills/cli-setup/references/03.add-entrypoint.md +128 -0
- package/dist/gen/skills/cli-setup/references/expected-outcome.md +3 -0
- package/dist/gen/skills/command-definition/.cli-docs.md +84 -0
- package/dist/gen/skills/command-definition/SKILL.md +99 -0
- package/dist/gen/skills/command-definition/references/00.assess-requirements.md +58 -0
- package/dist/gen/skills/command-definition/references/01.define-schema.md +72 -0
- package/dist/gen/skills/command-definition/references/02.implement-execute.md +118 -0
- package/dist/gen/skills/command-definition/references/03.add-prompting.md +54 -0
- package/dist/gen/skills/command-definition/references/expected-outcome.md +3 -0
- package/dist/gen/skills/service-definition/.cli-docs.md +214 -0
- package/dist/gen/skills/service-definition/SKILL.md +148 -0
- package/dist/gen/skills/service-definition/references/00.assess-service.md +69 -0
- package/dist/gen/skills/service-definition/references/01.define-service.md +166 -0
- package/dist/gen/skills/service-definition/references/02.add-preflight.md +132 -0
- package/dist/gen/skills/service-definition/references/03.add-project-scanner.md +82 -0
- package/dist/gen/skills/service-definition/references/04.wire-events.md +120 -0
- package/dist/gen/skills/service-definition/references/expected-outcome.md +3 -0
- package/dist/spec/types.d.ts +22 -0
- package/dist/spec/types.js +20 -1
- package/dist/triggers/spec-change.js +11 -0
- package/package.json +5 -4
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Phase 2: Add Preflight Validation Checks
|
|
2
|
+
|
|
3
|
+
Add checks that run before the service process spawns. These catch common failure modes early with clear error messages.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
### 1. Add workdir check
|
|
8
|
+
|
|
9
|
+
Use `checkWorkdir()` when the service requires specific directory structure:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { checkWorkdir } from '../framework.js';
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
|
|
16
|
+
preflight: [
|
|
17
|
+
checkWorkdir(
|
|
18
|
+
(cwd) => fs.existsSync(path.join(cwd, 'package.json')),
|
|
19
|
+
'Not a Node.js project',
|
|
20
|
+
'Run {id}-start --workdir <project-dir>, or create a project first',
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The `test` function receives the resolved working directory. Return `true` if valid.
|
|
26
|
+
|
|
27
|
+
You can check for multiple files:
|
|
28
|
+
```typescript
|
|
29
|
+
checkWorkdir(
|
|
30
|
+
(cwd) => fs.existsSync(path.join(cwd, 'powerhouse.config.ts'))
|
|
31
|
+
|| fs.existsSync(path.join(cwd, 'powerhouse.config.json')),
|
|
32
|
+
'Not a Reactor Package project',
|
|
33
|
+
'Run {id}-start --workdir <project>, or create one with /init',
|
|
34
|
+
),
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Add binary checks
|
|
38
|
+
|
|
39
|
+
Use `checkCommand()` for required binaries:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { checkCommand } from '../framework.js';
|
|
43
|
+
|
|
44
|
+
checkCommand('node', {
|
|
45
|
+
hint: 'Install Node.js from https://nodejs.org',
|
|
46
|
+
}),
|
|
47
|
+
checkCommand('pnpm', {
|
|
48
|
+
hint: 'Install pnpm: npm install -g pnpm',
|
|
49
|
+
}),
|
|
50
|
+
checkCommand('ph', {
|
|
51
|
+
hint: 'Install the Powerhouse CLI: npm install -g ph-cli',
|
|
52
|
+
}),
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
With version validation:
|
|
56
|
+
```typescript
|
|
57
|
+
checkCommand('node', {
|
|
58
|
+
versionFlag: '--version',
|
|
59
|
+
versionTest: (v) => parseInt(v.replace('v', '')) >= 22,
|
|
60
|
+
hint: 'Node.js >= 22 is required. Update from https://nodejs.org',
|
|
61
|
+
}),
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Add port checks
|
|
65
|
+
|
|
66
|
+
Use `checkPort()` for each port the service binds to:
|
|
67
|
+
|
|
68
|
+
**Static port**:
|
|
69
|
+
```typescript
|
|
70
|
+
import { checkPort } from '../framework.js';
|
|
71
|
+
|
|
72
|
+
checkPort(3000, 'Dev Server'),
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Dynamic port from params**:
|
|
76
|
+
```typescript
|
|
77
|
+
checkPort((ctx) => (ctx.params?.port as number) ?? 3000, 'Dev Server'),
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Multiple ports**:
|
|
81
|
+
```typescript
|
|
82
|
+
checkPort((ctx) => (ctx.params?.connectPort as number) ?? 3000, 'Connect Studio'),
|
|
83
|
+
checkPort((ctx) => (ctx.params?.switchboardPort as number) ?? 4001, 'Switchboard'),
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 4. Order checks correctly
|
|
87
|
+
|
|
88
|
+
Place checks in order from cheapest to most expensive:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
preflight: [
|
|
92
|
+
// 1. Workdir check — pure filesystem, instant
|
|
93
|
+
checkWorkdir(
|
|
94
|
+
(cwd) => fs.existsSync(path.join(cwd, 'package.json')),
|
|
95
|
+
'Not a Node.js project',
|
|
96
|
+
),
|
|
97
|
+
// 2. Binary check — spawns a process, fast
|
|
98
|
+
checkCommand('pnpm', { hint: 'Install pnpm: npm install -g pnpm' }),
|
|
99
|
+
// 3. Port check — network I/O, slowest
|
|
100
|
+
checkPort((ctx) => (ctx.params?.port as number) ?? 3000, 'Dev Server'),
|
|
101
|
+
],
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 5. Write custom preflight checks (if needed)
|
|
105
|
+
|
|
106
|
+
For checks not covered by the built-in factories, write a custom function:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
preflight: [
|
|
110
|
+
async (ctx) => {
|
|
111
|
+
const configPath = path.join(ctx.cwd, '.env');
|
|
112
|
+
if (!fs.existsSync(configPath)) {
|
|
113
|
+
return {
|
|
114
|
+
ok: false,
|
|
115
|
+
message: 'Missing .env file',
|
|
116
|
+
hint: 'Copy .env.example to .env and fill in the values',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return { ok: true };
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Custom checks receive `PreflightContext` with `cwd`, `config`, `params`, and `command`.
|
|
125
|
+
|
|
126
|
+
### 6. Write clear error messages and hints
|
|
127
|
+
|
|
128
|
+
Every failing check should tell the user:
|
|
129
|
+
- **What's wrong**: `'Port 3000 is already in use'`
|
|
130
|
+
- **How to fix it** (hint): `'Stop the other process or use --port <number>'`
|
|
131
|
+
|
|
132
|
+
Good hints save users from having to search for solutions.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Phase 3: Add Project Scanner (Optional)
|
|
2
|
+
|
|
3
|
+
Add project scanning when one service definition can manage multiple project directories. Skip this phase if the service always runs in a single fixed location.
|
|
4
|
+
|
|
5
|
+
## When to Add a Scanner
|
|
6
|
+
|
|
7
|
+
- A dev server that can run in any project folder matching a pattern
|
|
8
|
+
- A reactor service that works with any Powerhouse project
|
|
9
|
+
- Any service where users need to discover eligible project directories
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
### 1. Define the scanner
|
|
14
|
+
|
|
15
|
+
At minimum, implement `isProjectFolder`:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import fs from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
|
|
21
|
+
export const myService = defineService({
|
|
22
|
+
// ...
|
|
23
|
+
projectScanner: {
|
|
24
|
+
isProjectFolder: (p) => fs.existsSync(path.join(p, 'next.config.ts')),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Add getProjectName (recommended)
|
|
30
|
+
|
|
31
|
+
Extract a display name from the project directory:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
projectScanner: {
|
|
35
|
+
isProjectFolder: (p) => fs.existsSync(path.join(p, 'package.json')),
|
|
36
|
+
getProjectName: (p) => {
|
|
37
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(p, 'package.json'), 'utf-8'));
|
|
38
|
+
return pkg.name ?? path.basename(p);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Add getProjectConfig (optional)
|
|
44
|
+
|
|
45
|
+
Return project-specific configuration:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
getProjectConfig: (p) => {
|
|
49
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(p, 'package.json'), 'utf-8'));
|
|
50
|
+
return { name: pkg.name, version: pkg.version };
|
|
51
|
+
},
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 4. Add getDocumentLink (optional, Powerhouse projects)
|
|
55
|
+
|
|
56
|
+
Return a document reference for Powerhouse-linked projects:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
getDocumentLink: (p) => {
|
|
60
|
+
const configPath = path.join(p, 'powerhouse.config.json');
|
|
61
|
+
if (!fs.existsSync(configPath)) return undefined;
|
|
62
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
63
|
+
return config.documentId
|
|
64
|
+
? { documentId: config.documentId, documentType: config.documentType }
|
|
65
|
+
: undefined;
|
|
66
|
+
},
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 5. How scanning works
|
|
70
|
+
|
|
71
|
+
When `projectScanner` is defined:
|
|
72
|
+
- The auto-generated `{id}-ls` command becomes available
|
|
73
|
+
- `services.scanProjects(serviceId, rootDir)` performs a breadth-first search
|
|
74
|
+
- The scanner prunes subtrees at foreign project boundaries (`package.json`, `Cargo.toml`, etc.)
|
|
75
|
+
- Returns `ProjectScanResult[]` with `{ name, path, config?, documentId?, documentType? }`
|
|
76
|
+
|
|
77
|
+
### 6. Using scan results
|
|
78
|
+
|
|
79
|
+
Scan results are useful for:
|
|
80
|
+
- Listing projects in the REPL (`/{id}-ls`)
|
|
81
|
+
- Auto-starting services for discovered projects
|
|
82
|
+
- Building project selection menus in interactive mode
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Phase 4: Wire Service Lifecycle Events
|
|
2
|
+
|
|
3
|
+
Handle service state transitions for logging, notifications, and dependent actions.
|
|
4
|
+
|
|
5
|
+
## Steps
|
|
6
|
+
|
|
7
|
+
### 1. Add event handlers in defineCli
|
|
8
|
+
|
|
9
|
+
Service events are wired via the `events` property in `defineCli()`:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { defineCli } from '@powerhousedao/ph-clint';
|
|
13
|
+
|
|
14
|
+
const cli = defineCli({
|
|
15
|
+
// ...
|
|
16
|
+
services: [myService],
|
|
17
|
+
events: {
|
|
18
|
+
'service:pattern-matched': (event, log) => {
|
|
19
|
+
log.info(`${event.name}: matched "${event.patternName}" (${event.remaining} remaining)`);
|
|
20
|
+
},
|
|
21
|
+
'service:ready': (event, log) => {
|
|
22
|
+
log.info(`${event.name} is ready`);
|
|
23
|
+
if (event.endpoints) {
|
|
24
|
+
for (const [name, url] of Object.entries(event.endpoints)) {
|
|
25
|
+
log.info(` ${name}: ${url}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
'service:failed': (event, log) => {
|
|
30
|
+
log.error(`${event.name} failed: ${event.error}`);
|
|
31
|
+
},
|
|
32
|
+
'service:restarting': (event, log) => {
|
|
33
|
+
log.warn(`${event.name} restarting (attempt ${event.attempt}/${event.maxRetries})`);
|
|
34
|
+
},
|
|
35
|
+
'service:stopped': (event, log) => {
|
|
36
|
+
log.info(`${event.name} stopped`);
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 2. Understand event payloads
|
|
43
|
+
|
|
44
|
+
Each event handler receives `(event, log)`:
|
|
45
|
+
- `event` — typed payload with `id`, `instanceId`, `name`, and event-specific fields
|
|
46
|
+
- `log` — structured Logger with `debug`, `info`, `warn`, `error` methods
|
|
47
|
+
|
|
48
|
+
**`service:pattern-matched`** — fired progressively as each readiness pattern matches:
|
|
49
|
+
- `event.patternName` — which pattern matched
|
|
50
|
+
- `event.endpoints` — captured endpoints so far
|
|
51
|
+
- `event.endpointTypes` — endpoint types so far
|
|
52
|
+
- `event.remaining` — number of patterns still unmatched
|
|
53
|
+
|
|
54
|
+
**`service:ready`** — fired when ALL patterns have matched:
|
|
55
|
+
- `event.endpoints` — all captured endpoints
|
|
56
|
+
- `event.endpointTypes` — all endpoint types
|
|
57
|
+
|
|
58
|
+
**`service:failed`** — fired on readiness timeout or process crash:
|
|
59
|
+
- `event.error` — error message (includes log tail for diagnosis)
|
|
60
|
+
|
|
61
|
+
**`service:restarting`** — fired when auto-restart triggers:
|
|
62
|
+
- `event.attempt` — current attempt number
|
|
63
|
+
- `event.maxRetries` — maximum attempts configured
|
|
64
|
+
|
|
65
|
+
**`service:stopped`** — fired after explicit stop completes
|
|
66
|
+
|
|
67
|
+
### 3. Common event patterns
|
|
68
|
+
|
|
69
|
+
**Log endpoints on ready**:
|
|
70
|
+
```typescript
|
|
71
|
+
'service:ready': (event, log) => {
|
|
72
|
+
const urls = Object.entries(event.endpoints ?? {})
|
|
73
|
+
.map(([name, url]) => ` ${name}: ${url}`)
|
|
74
|
+
.join('\n');
|
|
75
|
+
log.info(`${event.name} ready\n${urls}`);
|
|
76
|
+
},
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Trigger dependent service startup**:
|
|
80
|
+
```typescript
|
|
81
|
+
'service:ready': async (event, log) => {
|
|
82
|
+
if (event.id === 'backend') {
|
|
83
|
+
log.info('Backend ready, starting frontend...');
|
|
84
|
+
// Frontend can now connect to the backend URL
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Progress feedback during startup**:
|
|
90
|
+
```typescript
|
|
91
|
+
'service:pattern-matched': (event, log) => {
|
|
92
|
+
if (event.remaining > 0) {
|
|
93
|
+
log.info(`${event.name}: ${event.patternName} ready, waiting for ${event.remaining} more...`);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 4. Register the service in defineCli
|
|
99
|
+
|
|
100
|
+
**In a codegen-managed project** (cli.ts has `@clint:begin` markers):
|
|
101
|
+
|
|
102
|
+
Do NOT manually edit `cli.ts` marker regions. Instead:
|
|
103
|
+
|
|
104
|
+
1. Add the service to `project-spec.json`
|
|
105
|
+
2. Run `clint-project-regen` — this regenerates the `@clint:begin services`, `@clint:begin imports`, and `@clint:begin events` marker regions
|
|
106
|
+
3. Run `clint-project-build` to verify TypeScript compiles
|
|
107
|
+
|
|
108
|
+
**In a manually-managed project** (no markers):
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
import { myService } from './services/my-service.js';
|
|
112
|
+
|
|
113
|
+
const cli = defineCli({
|
|
114
|
+
services: [myService],
|
|
115
|
+
events: { /* ... */ },
|
|
116
|
+
// ...
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
This auto-injects the management commands: `{id}-start`, `{id}-stop`, `{id}-restart`, `{id}-ps`, `{id}-logs`, `{id}-manage`, and `{id}-ls` (if projectScanner is defined).
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
## Expected Outcome
|
|
2
|
+
|
|
3
|
+
Service is defined with readiness detection, preflight checks, and lifecycle config. It is registered in `defineCli`, auto-generates management commands (`{id}-start`, `{id}-stop`, etc.), and transitions through starting/ready/failed states correctly. Endpoints are captured and typed. Preflight checks fail fast with clear messages and hints.
|
package/dist/spec/types.d.ts
CHANGED
|
@@ -23,6 +23,17 @@ export declare const powerhouseLevelSchema: z.ZodDefault<z.ZodEnum<{
|
|
|
23
23
|
export type PowerhouseLevel = z.infer<typeof powerhouseLevelSchema>;
|
|
24
24
|
/** Check whether `level` is at least `threshold` in the ordered enum. */
|
|
25
25
|
export declare function phAtLeast(level: PowerhouseLevel, threshold: PowerhouseLevel): boolean;
|
|
26
|
+
export declare const agentModelSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
isDefault: z.ZodBoolean;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type AgentModel = z.infer<typeof agentModelSchema>;
|
|
31
|
+
export declare const agentProfileSchema: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
title: z.ZodString;
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type AgentProfile = z.infer<typeof agentProfileSchema>;
|
|
26
37
|
export declare const powerhousePackageSchema: z.ZodObject<{
|
|
27
38
|
id: z.ZodString;
|
|
28
39
|
packageName: z.ZodString;
|
|
@@ -50,6 +61,17 @@ export declare const clintProjectSpecSchema: z.ZodObject<{
|
|
|
50
61
|
}>>;
|
|
51
62
|
mastra: z.ZodDefault<z.ZodObject<{
|
|
52
63
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
64
|
+
agentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
65
|
+
agentName: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
models: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
isDefault: z.ZodBoolean;
|
|
69
|
+
}, z.core.$strip>>>;
|
|
70
|
+
profiles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
title: z.ZodString;
|
|
73
|
+
content: z.ZodString;
|
|
74
|
+
}, z.core.$strip>>>;
|
|
53
75
|
}, z.core.$strip>>;
|
|
54
76
|
routine: z.ZodDefault<z.ZodObject<{
|
|
55
77
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
package/dist/spec/types.js
CHANGED
|
@@ -26,13 +26,32 @@ export const powerhouseLevelSchema = z
|
|
|
26
26
|
export function phAtLeast(level, threshold) {
|
|
27
27
|
return (POWERHOUSE_LEVELS.indexOf(level) >= POWERHOUSE_LEVELS.indexOf(threshold));
|
|
28
28
|
}
|
|
29
|
+
export const agentModelSchema = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
isDefault: z.boolean(),
|
|
32
|
+
});
|
|
33
|
+
export const agentProfileSchema = z.object({
|
|
34
|
+
id: z.string(),
|
|
35
|
+
title: z.string(),
|
|
36
|
+
content: z.string(),
|
|
37
|
+
});
|
|
29
38
|
const mastraFeatureSchema = z.object({
|
|
30
39
|
enabled: z.boolean().default(false),
|
|
40
|
+
agentId: z.string().nullable().default(null),
|
|
41
|
+
agentName: z.string().nullable().default(null),
|
|
42
|
+
models: z.array(agentModelSchema).default([]),
|
|
43
|
+
profiles: z.array(agentProfileSchema).default([]),
|
|
31
44
|
});
|
|
32
45
|
const routineFeatureSchema = z.object({
|
|
33
46
|
enabled: z.boolean().default(false),
|
|
34
47
|
});
|
|
35
|
-
const DEFAULT_MASTRA = {
|
|
48
|
+
const DEFAULT_MASTRA = {
|
|
49
|
+
enabled: false,
|
|
50
|
+
agentId: null,
|
|
51
|
+
agentName: null,
|
|
52
|
+
models: [],
|
|
53
|
+
profiles: [],
|
|
54
|
+
};
|
|
36
55
|
const DEFAULT_ROUTINE = { enabled: false };
|
|
37
56
|
export const powerhousePackageSchema = z.object({
|
|
38
57
|
id: z.string(),
|
|
@@ -86,6 +86,17 @@ export function specToImportInput(spec) {
|
|
|
86
86
|
powerhouse: spec.features.powerhouse,
|
|
87
87
|
mastraEnabled: spec.features.mastra.enabled,
|
|
88
88
|
routineEnabled: spec.features.routine.enabled,
|
|
89
|
+
agentId: spec.features.mastra.agentId ?? null,
|
|
90
|
+
agentName: spec.features.mastra.agentName ?? null,
|
|
91
|
+
models: spec.features.mastra.models.map(m => ({
|
|
92
|
+
id: m.id,
|
|
93
|
+
isDefault: m.isDefault,
|
|
94
|
+
})),
|
|
95
|
+
profiles: spec.features.mastra.profiles.map(p => ({
|
|
96
|
+
id: p.id,
|
|
97
|
+
title: p.title,
|
|
98
|
+
content: p.content,
|
|
99
|
+
})),
|
|
89
100
|
packages: spec.packages.map(p => ({
|
|
90
101
|
id: p.id,
|
|
91
102
|
packageName: p.packageName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/ph-clint-cli",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.24",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"dev": "tsx src/main.ts",
|
|
19
19
|
"start": "node dist/main.js",
|
|
20
20
|
"test": "NODE_OPTIONS='--experimental-vm-modules' jest --detectOpenHandles",
|
|
21
|
+
"test:e2e": "NODE_OPTIONS='--experimental-vm-modules' jest --detectOpenHandles --testPathPatterns 'tests/(e2e|codegen-e2e)/' --testPathIgnorePatterns '/node_modules/'",
|
|
21
22
|
"lint": "eslint src",
|
|
22
23
|
"mastra:dev": "mastra dev",
|
|
23
24
|
"mastra:build": "mastra build",
|
|
@@ -28,9 +29,9 @@
|
|
|
28
29
|
"@mastra/core": "^1.22.0",
|
|
29
30
|
"@mastra/libsql": "^1.7.4",
|
|
30
31
|
"@mastra/memory": "^1.13.1",
|
|
31
|
-
"@powerhousedao/ph-clint": "^0.1.0-dev.
|
|
32
|
-
"@powerhousedao/ph-clint-app": "^0.1.0-dev.
|
|
33
|
-
"@powerhousedao/ph-clint-dev": "^0.1.0-dev.
|
|
32
|
+
"@powerhousedao/ph-clint": "^0.1.0-dev.24",
|
|
33
|
+
"@powerhousedao/ph-clint-app": "^0.1.0-dev.24",
|
|
34
|
+
"@powerhousedao/ph-clint-dev": "^0.1.0-dev.24",
|
|
34
35
|
"@powerhousedao/reactor": "6.0.0-dev.170",
|
|
35
36
|
"@powerhousedao/reactor-api": "6.0.0-dev.170",
|
|
36
37
|
"@powerhousedao/shared": "6.0.0-dev.170",
|