@powerhousedao/ph-clint-cli 0.1.0-dev.17 → 0.1.0-dev.19

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.
@@ -16,8 +16,6 @@ export function buildCliTs(spec) {
16
16
  lines.push(' * Everything outside the markers is user-editable and preserved.');
17
17
  lines.push(' */');
18
18
  if (phAtLeast(ph, 'Reactor')) {
19
- lines.push(`import path from 'node:path';`);
20
- lines.push(`import { existsSync } from 'node:fs';`);
21
19
  lines.push(`import { defineCli, buildDefaultReactor } from '@powerhousedao/ph-clint';`);
22
20
  }
23
21
  else {
@@ -35,20 +33,12 @@ export function buildCliTs(spec) {
35
33
  }
36
34
  lines.push('// @clint:end imports');
37
35
  lines.push('');
38
- if (phAtLeast(ph, 'Reactor')) {
39
- lines.push(`const appDir = path.resolve(CLI_ROOT, '../${spec.name}-app');`);
40
- lines.push('');
41
- if (phAtLeast(ph, 'Connect')) {
42
- lines.push('function resolveConnectAssets(dir: string): string | undefined {');
43
- lines.push(" const assetsDir = path.join(dir, 'dist', 'connect');");
44
- lines.push(" return existsSync(path.join(assetsDir, 'index.html')) ? assetsDir : undefined;");
45
- lines.push('}');
46
- lines.push('');
47
- }
48
- }
49
36
  lines.push('export const cli = defineCli({');
50
37
  lines.push(' name: CLI_NAME,');
51
38
  lines.push(' version: CLI_VERSION,');
39
+ if (phAtLeast(ph, 'Reactor')) {
40
+ lines.push(' root: CLI_ROOT,');
41
+ }
52
42
  lines.push(' description: `${CLI_NAME} v${CLI_VERSION}`,');
53
43
  lines.push(' configSchema,');
54
44
  lines.push(' secretsSchema,');
@@ -120,12 +110,7 @@ export function buildCliTs(spec) {
120
110
  lines.push(` drive: { name: '${spec.name}' },`);
121
111
  lines.push(' }),');
122
112
  lines.push(` switchboard: { enabled: ${String(phAtLeast(ph, 'Switchboard'))} },`);
123
- if (phAtLeast(ph, 'Connect')) {
124
- lines.push(` connect: { enabled: true, workdir: appDir, assetsDir: resolveConnectAssets(appDir) },`);
125
- }
126
- else {
127
- lines.push(` connect: { enabled: false },`);
128
- }
113
+ lines.push(` connect: { enabled: ${String(phAtLeast(ph, 'Connect'))} },`);
129
114
  lines.push('});');
130
115
  }
131
116
  lines.push('// @clint:end reactor');
@@ -31,11 +31,11 @@ export async function runPhInit(options) {
31
31
  if (result.exitCode !== 0) {
32
32
  log(`\`${binName} init\` exited with code ${result.exitCode}. ` +
33
33
  'You can re-run it manually after resolving the issue.');
34
- return { ran: true, exitCode: result.exitCode };
35
34
  }
36
35
  // ph init creates an unscoped package name. If the spec has a scope, patch
37
36
  // the app's package.json to use the scoped name so `file:` deps and publish
38
- // both resolve correctly.
37
+ // both resolve correctly. Run even on non-zero exit — ph init may have
38
+ // partially succeeded and created package.json.
39
39
  if (options.spec.scope) {
40
40
  const appPkgJsonPath = path.join(options.appDir, 'package.json');
41
41
  try {
@@ -186,6 +186,25 @@ export const specChangeTrigger = createDocumentChangeTrigger({
186
186
  log?.warn(`${TAG} ph init exited with code ${phResult.exitCode}`);
187
187
  }
188
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
+ }
189
208
  }
190
209
  // Sync external skills after codegen.
191
210
  if (spec.externalSkills.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-clint-cli",
3
- "version": "0.1.0-dev.17",
3
+ "version": "0.1.0-dev.19",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,19 +25,19 @@
25
25
  "mastra:start": "mastra start"
26
26
  },
27
27
  "dependencies": {
28
- "@powerhousedao/ph-clint": "^0.1.0-dev.15",
29
- "@powerhousedao/ph-clint-app": "^0.1.0-dev.17",
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.19",
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",
40
- "@powerhousedao/ph-clint-dev": "^0.1.0-dev.15",
41
41
  "zod": "^4.3.6"
42
42
  },
43
43
  "pnpm": {