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

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.
@@ -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.18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@powerhousedao/ph-clint": "^0.1.0-dev.15",
29
- "@powerhousedao/ph-clint-app": "^0.1.0-dev.17",
29
+ "@powerhousedao/ph-clint-app": "^0.1.0-dev.18",
30
30
  "@mastra/core": "^1.22.0",
31
31
  "@mastra/libsql": "^1.7.4",
32
32
  "@mastra/memory": "^1.13.1",