@powerhousedao/ph-clint-cli 0.1.0-dev.2 → 0.1.0-dev.20
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 +13 -8
- package/dist/codegen/builders/app-index-ts.d.ts +3 -10
- package/dist/codegen/builders/app-index-ts.js +10 -14
- package/dist/codegen/builders/cli-package-json.js +47 -8
- package/dist/codegen/builders/cli-ts.js +18 -15
- package/dist/codegen/builders/config-ts.js +11 -15
- package/dist/codegen/builders/framework-gen-ts.d.ts +4 -5
- package/dist/codegen/builders/framework-gen-ts.js +22 -19
- package/dist/codegen/builders/framework-ts.js +21 -1
- package/dist/codegen/builders/index.d.ts +1 -0
- package/dist/codegen/builders/index.js +1 -0
- package/dist/codegen/builders/publish-config-ts.d.ts +6 -0
- package/dist/codegen/builders/publish-config-ts.js +21 -0
- package/dist/codegen/builders/readme-md.js +8 -7
- package/dist/codegen/builders/root-package-json.d.ts +3 -0
- package/dist/codegen/builders/root-package-json.js +24 -11
- package/dist/codegen/index.js +24 -11
- package/dist/codegen/scaffold.d.ts +8 -0
- package/dist/codegen/scaffold.js +51 -2
- package/dist/commands/clint-project-init.d.ts +11 -6
- package/dist/commands/clint-project-init.js +8 -7
- package/dist/commands/clint-project-publish.d.ts +1 -0
- package/dist/commands/clint-project-publish.js +5 -3
- package/dist/commands/clint-project-regen.js +2 -2
- package/dist/commands/clint-skills-sync.d.ts +10 -0
- package/dist/commands/clint-skills-sync.js +56 -0
- package/dist/config.d.ts +3 -5
- package/dist/config.js +5 -7
- package/dist/framework.d.ts +5 -160
- package/dist/framework.gen.d.ts +1 -32
- package/dist/framework.gen.js +1 -1
- package/dist/skills/sync.d.ts +40 -0
- package/dist/skills/sync.js +119 -0
- package/dist/spec/from-document.js +11 -7
- package/dist/spec/types.d.ts +55 -6
- package/dist/spec/types.js +61 -25
- package/dist/triggers/publish-trigger.d.ts +11 -0
- package/dist/triggers/publish-trigger.js +172 -0
- package/dist/triggers/spec-change.d.ts +1 -32
- package/dist/triggers/spec-change.js +59 -0
- package/package.json +5 -5
|
@@ -9,35 +9,4 @@ export declare const specChangeTrigger: import("@powerhousedao/ph-clint").Trigge
|
|
|
9
9
|
phVersion: string;
|
|
10
10
|
projectDocumentId?: string | undefined;
|
|
11
11
|
apiKey?: string | undefined;
|
|
12
|
-
}, import("@powerhousedao/ph-clint").InferRegistry<readonly [
|
|
13
|
-
readonly version: 1;
|
|
14
|
-
readonly reducer: import("document-model").Reducer<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
|
|
15
|
-
readonly actions: {
|
|
16
|
-
enableRoutine: (input: import("@powerhousedao/ph-clint-app").EnableRoutineInput) => import("@powerhousedao/ph-clint-app").EnableRoutineAction;
|
|
17
|
-
disableRoutine: (input: import("@powerhousedao/ph-clint-app").DisableRoutineInput) => import("@powerhousedao/ph-clint-app").DisableRoutineAction;
|
|
18
|
-
enableMastra: (input: import("@powerhousedao/ph-clint-app").EnableMastraInput) => import("@powerhousedao/ph-clint-app").EnableMastraAction;
|
|
19
|
-
disableMastra: (input: import("@powerhousedao/ph-clint-app").DisableMastraInput) => import("@powerhousedao/ph-clint-app").DisableMastraAction;
|
|
20
|
-
enablePowerhouse: (input: import("@powerhousedao/ph-clint-app").EnablePowerhouseInput) => import("@powerhousedao/ph-clint-app").EnablePowerhouseAction;
|
|
21
|
-
setPowerhouseSwitchboard: (input: import("@powerhousedao/ph-clint-app").SetPowerhouseSwitchboardInput) => import("@powerhousedao/ph-clint-app").SetPowerhouseSwitchboardAction;
|
|
22
|
-
setPowerhouseConnect: (input: import("@powerhousedao/ph-clint-app").SetPowerhouseConnectInput) => import("@powerhousedao/ph-clint-app").SetPowerhouseConnectAction;
|
|
23
|
-
setPackageName: (input: import("@powerhousedao/ph-clint-app").SetPackageNameInput) => import("@powerhousedao/ph-clint-app").SetPackageNameAction;
|
|
24
|
-
clearBin: (input: import("@powerhousedao/ph-clint-app").ClearBinInput) => import("@powerhousedao/ph-clint-app").ClearBinAction;
|
|
25
|
-
setBin: (input: import("@powerhousedao/ph-clint-app").SetBinInput) => import("@powerhousedao/ph-clint-app").SetBinAction;
|
|
26
|
-
setDescription: (input: import("@powerhousedao/ph-clint-app").SetDescriptionInput) => import("@powerhousedao/ph-clint-app").SetDescriptionAction;
|
|
27
|
-
setVersion: (input: import("@powerhousedao/ph-clint-app").SetVersionInput) => import("@powerhousedao/ph-clint-app").SetVersionAction;
|
|
28
|
-
clearScope: (input: import("@powerhousedao/ph-clint-app").ClearScopeInput) => import("@powerhousedao/ph-clint-app").ClearScopeAction;
|
|
29
|
-
setScope: (input: import("@powerhousedao/ph-clint-app").SetScopeInput) => import("@powerhousedao/ph-clint-app").SetScopeAction;
|
|
30
|
-
setName: (name: string | {
|
|
31
|
-
name: string;
|
|
32
|
-
}) => import("document-model").SetNameAction;
|
|
33
|
-
undo: (count?: number, scope?: string) => import("document-model").UndoAction;
|
|
34
|
-
redo: (count?: number, scope?: string) => import("document-model").RedoAction;
|
|
35
|
-
prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
|
|
36
|
-
loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
|
|
37
|
-
name: string;
|
|
38
|
-
}, operations: number) => import("document-model").LoadStateAction;
|
|
39
|
-
noop: (scope?: string) => import("document-model").NOOPAction;
|
|
40
|
-
};
|
|
41
|
-
readonly utils: import("document-model").DocumentModelUtils<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
|
|
42
|
-
readonly documentModel: import("document-model").DocumentModelPHState;
|
|
43
|
-
}]>>;
|
|
12
|
+
}, import("@powerhousedao/ph-clint").InferRegistry<readonly [import("document-model").DocumentModelModule<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>]>>;
|
|
@@ -20,7 +20,9 @@ import fs from 'node:fs/promises';
|
|
|
20
20
|
import path from 'node:path';
|
|
21
21
|
import { createDocumentChangeTrigger } from '../framework.js';
|
|
22
22
|
import { generateProject } from '../codegen/index.js';
|
|
23
|
+
import { runPhInit } from '../codegen/scaffold.js';
|
|
23
24
|
import { specFromDocumentState } from '../spec/from-document.js';
|
|
25
|
+
import { syncExternalSkills } from '../skills/sync.js';
|
|
24
26
|
const DOCUMENT_TYPE = 'powerhouse/ph-clint-project';
|
|
25
27
|
const HASH_DIR = path.join('.ph', 'ph-clint-cli');
|
|
26
28
|
const HASH_FILE = '.last-spec-hash';
|
|
@@ -147,6 +149,7 @@ export const specChangeTrigger = createDocumentChangeTrigger({
|
|
|
147
149
|
targetDir,
|
|
148
150
|
spec,
|
|
149
151
|
mode: 'update',
|
|
152
|
+
force: true,
|
|
150
153
|
onWarn: (m) => warnings.push(m),
|
|
151
154
|
});
|
|
152
155
|
await writeLastSpecHash(targetDir, nextHash);
|
|
@@ -158,6 +161,62 @@ export const specChangeTrigger = createDocumentChangeTrigger({
|
|
|
158
161
|
for (const w of warnings)
|
|
159
162
|
log.warn(`${TAG} ${w}`);
|
|
160
163
|
}
|
|
164
|
+
// Scaffold the reactor package (app dir) if it hasn't been initialized yet.
|
|
165
|
+
if (result.appDir) {
|
|
166
|
+
const appPkgJson = path.join(result.appDir, 'package.json');
|
|
167
|
+
let appExists = false;
|
|
168
|
+
try {
|
|
169
|
+
await fs.access(appPkgJson);
|
|
170
|
+
appExists = true;
|
|
171
|
+
}
|
|
172
|
+
catch { /* noop */ }
|
|
173
|
+
if (!appExists) {
|
|
174
|
+
log?.info(`${TAG} initializing reactor package at ${result.appDir}`);
|
|
175
|
+
const phResult = await runPhInit({
|
|
176
|
+
targetDir,
|
|
177
|
+
appDir: result.appDir,
|
|
178
|
+
spec,
|
|
179
|
+
log: (msg) => log?.info(`${TAG} ${msg}`),
|
|
180
|
+
stdio: 'ignore',
|
|
181
|
+
});
|
|
182
|
+
if (!phResult.ran) {
|
|
183
|
+
log?.warn(`${TAG} ph init skipped: ${phResult.reason ?? 'unknown'}`);
|
|
184
|
+
}
|
|
185
|
+
else if (phResult.exitCode !== 0) {
|
|
186
|
+
log?.warn(`${TAG} ph init exited with code ${phResult.exitCode}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Always ensure the app package name matches the spec's scope,
|
|
190
|
+
// even if ph init ran in a previous trigger cycle without scope.
|
|
191
|
+
if (spec.scope) {
|
|
192
|
+
try {
|
|
193
|
+
const raw = await fs.readFile(appPkgJson, 'utf8');
|
|
194
|
+
const pkg = JSON.parse(raw);
|
|
195
|
+
const appFolder = path.basename(result.appDir);
|
|
196
|
+
const scopedName = `@${spec.scope}/${appFolder}`;
|
|
197
|
+
if (pkg.name !== scopedName) {
|
|
198
|
+
pkg.name = scopedName;
|
|
199
|
+
pkg.publishConfig = { access: 'public' };
|
|
200
|
+
await fs.writeFile(appPkgJson, JSON.stringify(pkg, null, 2) + '\n');
|
|
201
|
+
log?.info(`${TAG} patched app package name to ${scopedName}`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
log?.warn(`${TAG} could not patch app package name: ${err instanceof Error ? err.message : String(err)}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// Sync external skills after codegen.
|
|
210
|
+
if (spec.externalSkills.length > 0) {
|
|
211
|
+
const skillsResult = await syncExternalSkills({
|
|
212
|
+
targetDir,
|
|
213
|
+
desired: spec.externalSkills,
|
|
214
|
+
log: (msg) => log?.info(`${TAG} ${msg}`),
|
|
215
|
+
});
|
|
216
|
+
if (log && (skillsResult.added.length > 0 || skillsResult.removed.length > 0)) {
|
|
217
|
+
log.info(`${TAG} skills sync: +${skillsResult.added.length} -${skillsResult.removed.length}`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
161
220
|
},
|
|
162
221
|
},
|
|
163
222
|
callbacks: {
|
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.20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,15 +25,16 @@
|
|
|
25
25
|
"mastra:start": "mastra start"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@powerhousedao/ph-clint-app": "^0.1.0-dev.2",
|
|
28
|
+
"@electric-sql/pglite": "0.3.15",
|
|
30
29
|
"@mastra/core": "^1.22.0",
|
|
31
30
|
"@mastra/libsql": "^1.7.4",
|
|
32
31
|
"@mastra/memory": "^1.13.1",
|
|
32
|
+
"@powerhousedao/ph-clint": "0.1.0-dev.18",
|
|
33
|
+
"@powerhousedao/ph-clint-app": "^0.1.0-dev.20",
|
|
34
|
+
"@powerhousedao/ph-clint-dev": "0.1.0-dev.18",
|
|
33
35
|
"@powerhousedao/reactor": "6.0.0-dev.170",
|
|
34
36
|
"@powerhousedao/reactor-api": "6.0.0-dev.170",
|
|
35
37
|
"@powerhousedao/shared": "6.0.0-dev.170",
|
|
36
|
-
"@electric-sql/pglite": "0.3.15",
|
|
37
38
|
"document-model": "6.0.0-dev.170",
|
|
38
39
|
"kysely": "^0.27.0",
|
|
39
40
|
"kysely-pglite-dialect": "^1.3.0",
|
|
@@ -48,7 +49,6 @@
|
|
|
48
49
|
"@jest/globals": "^30.2.0",
|
|
49
50
|
"@types/node": "^25.5.2",
|
|
50
51
|
"jest": "^30.2.0",
|
|
51
|
-
"@powerhousedao/ph-clint-dev": "^0.1.0-dev.2",
|
|
52
52
|
"ts-jest": "^29.4.6",
|
|
53
53
|
"tsx": "^4.19.0",
|
|
54
54
|
"typescript": "^6.0.2"
|