@powerhousedao/ph-clint-cli 0.1.0-dev.52 → 0.1.0-dev.53

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  * Everything outside the markers is user-editable and preserved.
8
8
  */
9
9
  import path from 'node:path';
10
- import { defineCli, buildDefaultReactor } from '@powerhousedao/ph-clint';
10
+ import { defineCli, buildDefaultReactor, deterministicId } from '@powerhousedao/ph-clint';
11
11
  import { z } from 'zod';
12
12
  import { CLI_NAME, CLI_VERSION, CLI_ROOT } from './config.js';
13
13
  import { configSchema, secretsSchema } from './framework.js';
@@ -38,6 +38,7 @@ export const cli = defineCli({
38
38
  // @clint:end services
39
39
  // @clint:begin triggers
40
40
  triggers: [specChangeTrigger, publishTrigger],
41
+ routine: { id: 'triggers', name: 'Triggers' },
41
42
  // @clint:end triggers
42
43
  // @clint:begin prompts
43
44
  prompts: {
@@ -108,7 +109,7 @@ cli.configureReactor({
108
109
  create: (ctx) => buildDefaultReactor(ctx, {
109
110
  documentModels,
110
111
  drives: [
111
- { name: 'Clint Folders', role: 'personal' },
112
+ { name: 'Clint Folders', role: 'personal', id: deterministicId(CLI_NAME, 'personal-drive') },
112
113
  ],
113
114
  subscriptions: { documentTypes: ['powerhouse/ph-clint-project'] },
114
115
  }),
@@ -11,29 +11,33 @@ import { getAppPackageName, getDocumentTypeSlug, isDocTypeGlob, phAtLeast, } fro
11
11
  export function buildAppIndexTs(spec) {
12
12
  if (!phAtLeast(spec.features.powerhouse, 'Reactor'))
13
13
  return null;
14
+ const lines = [];
15
+ // Standard Powerhouse reactor-package barrel — matches what `ph init`
16
+ // generates. Required by main.tsx (Connect) and cli.ts imports.
17
+ lines.push('// THIS FILE IS GENERATED BY ph-clint-cli.');
18
+ lines.push("import type { Manifest } from 'document-model';");
19
+ lines.push("import manifestJson from './powerhouse.manifest.json' with { type: 'json' };");
20
+ lines.push("export { documentModels } from './document-models/document-models.js';");
21
+ lines.push("export { upgradeManifests } from './document-models/upgrade-manifests.js';");
22
+ lines.push("export { editors } from './editors/editors.js';");
23
+ lines.push("export { processorFactory } from './processors/factory.js';");
24
+ lines.push('export const manifest: Manifest = manifestJson;');
25
+ // Per-document-type re-exports so impl code can import from
26
+ // '{name}-app' instead of drilling into deep paths.
14
27
  const appPkg = getAppPackageName(spec);
15
28
  const appEntry = spec.packages.find((p) => p.packageName === appPkg);
16
29
  const docTypes = appEntry?.documentTypes ?? [];
17
- if (docTypes.length === 0)
18
- return null;
19
- const hasGlobs = docTypes.some(isDocTypeGlob);
20
- const explicits = docTypes.filter((dt) => !isDocTypeGlob(dt));
21
- const lines = [];
22
- lines.push('// THIS FILE IS GENERATED BY ph-clint-cli.');
23
- lines.push('// Re-exports every registered document model from a single top-level');
24
- lines.push('// entry so impl code can `import { ... } from \'{name}-app\'`.');
25
- lines.push('');
26
- if (hasGlobs) {
27
- // Glob patterns can't enumerate slugs at codegen time — re-export
28
- // from the Powerhouse-generated barrel which already re-exports all
29
- // document models in the package.
30
- lines.push("export * from './document-models/index.js';");
31
- }
32
- // Explicit entries still get per-slug re-exports (they may point at
33
- // models not yet in the generated barrel during bootstrapping).
34
- for (const docType of explicits) {
35
- const slug = getDocumentTypeSlug(docType);
36
- lines.push(`export * from './document-models/${slug}/index.js';`);
30
+ if (docTypes.length > 0) {
31
+ const hasGlobs = docTypes.some(isDocTypeGlob);
32
+ const explicits = docTypes.filter((dt) => !isDocTypeGlob(dt));
33
+ lines.push('');
34
+ if (hasGlobs) {
35
+ lines.push("export * from './document-models/index.js';");
36
+ }
37
+ for (const docType of explicits) {
38
+ const slug = getDocumentTypeSlug(docType);
39
+ lines.push(`export * from './document-models/${slug}/index.js';`);
40
+ }
37
41
  }
38
42
  return lines.join('\n') + '\n';
39
43
  }
@@ -49,3 +49,4 @@ export { buildCliPackageJson, buildCliTs, buildConfigTs, buildMainTs, buildTscon
49
49
  export { buildRootPackageJson } from './root-package-json.js';
50
50
  export { buildPublishConfigJs } from './publish-config-js.js';
51
51
  export { buildReadme } from './readme-md.js';
52
+ export { buildAppIndexTs } from './app-index-ts.js';
@@ -82,3 +82,4 @@ export { buildCliPackageJson, buildCliTs, buildConfigTs, buildMainTs, buildTscon
82
82
  export { buildRootPackageJson } from './root-package-json.js';
83
83
  export { buildPublishConfigJs } from './publish-config-js.js';
84
84
  export { buildReadme } from './readme-md.js';
85
+ export { buildAppIndexTs } from './app-index-ts.js';
@@ -35,7 +35,7 @@ import { hashContent, hashFile, readHashes, writeHashes, } from './hashes.js';
35
35
  import { hasMarkers, spliceMarkerRegions } from './markers.js';
36
36
  import { writeFileEnsuringDir, isDirEmptyEnough } from './write.js';
37
37
  import { migrateFlatToSplit } from './migrate/flat-to-split.js';
38
- import { CLI_FILE_BUILDERS, getProfileFileBuilders, buildReadme, buildRootPackageJson, buildPublishConfigJs, } from './builders/index.js';
38
+ import { CLI_FILE_BUILDERS, getProfileFileBuilders, buildReadme, buildRootPackageJson, buildPublishConfigJs, buildAppIndexTs, } from './builders/index.js';
39
39
  import { collectPostGenActions, } from './actions.js';
40
40
  import { readGeneratedState, writeGeneratedState, generatedStateFromSpec, } from './generated.js';
41
41
  import { patchAppPackageName } from './scaffold.js';
@@ -135,6 +135,17 @@ function planFiles(spec, targetDir) {
135
135
  absolutePath: appReadme,
136
136
  content: buildAppReadmeContent(spec),
137
137
  });
138
+ // Top-level barrel for the reactor package — lets impl code import from
139
+ // `{name}-app` instead of drilling into `document-models/<slug>/v1/gen`.
140
+ const appIndex = buildAppIndexTs(spec);
141
+ if (appIndex !== null) {
142
+ const appIndexAbs = path.join(appDir, 'index.ts');
143
+ planned.push({
144
+ relativePath: path.relative(targetDir, appIndexAbs),
145
+ absolutePath: appIndexAbs,
146
+ content: appIndex,
147
+ });
148
+ }
138
149
  }
139
150
  return { planned, cliDir, appDir };
140
151
  }
@@ -104,7 +104,7 @@ export const publishTrigger = createDocumentChangeTrigger({
104
104
  try {
105
105
  stdout(`${TAG} invoking clint-project-publish --tag ${cliTag}\n`);
106
106
  const { clintProjectPublish } = await import('../commands/clint-project-publish.js');
107
- const result = await clintProjectPublish.execute({ tag: cliTag, dryRun: false, skipBuild: false, skipGitCheck: true, verbose: false }, ctx.commandContext);
107
+ const result = await clintProjectPublish.execute({ tag: cliTag, dir: workdir, dryRun: false, skipBuild: false, skipGitCheck: true, verbose: false }, ctx.commandContext);
108
108
  success = !result.text.includes('failed');
109
109
  }
110
110
  catch (err) {
@@ -105,12 +105,18 @@ export function specToImportInput(spec) {
105
105
  name: s.name,
106
106
  githubUrl: s.githubUrl,
107
107
  })),
108
+ agentDescription: spec.features.mastra.agentDescription ?? null,
109
+ agentImage: spec.features.mastra.agentImage ?? null,
110
+ enableChat: spec.features.mastra.common.enableChat,
111
+ proxyEnabled: spec.deployment.proxyEnabled,
112
+ supportedResources: spec.deployment.supportedResources,
108
113
  };
109
114
  }
110
115
  export const specChangeTrigger = createDocumentChangeTrigger({
111
116
  id: 'spec-change',
112
117
  documentType: DOCUMENT_TYPE,
113
118
  // No documentId → watches ALL ph-clint-project docs
119
+ callOnEmpty: true, // bootstrap from disk when no documents exist yet
114
120
  async onChange(docs, ctx) {
115
121
  const log = ctx.context.log;
116
122
  const folders = ctx.context.folders;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-clint-cli",
3
- "version": "0.1.0-dev.52",
3
+ "version": "0.1.0-dev.53",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -29,9 +29,9 @@
29
29
  "@mastra/core": "^1.22.0",
30
30
  "@mastra/libsql": "^1.7.4",
31
31
  "@mastra/memory": "^1.13.1",
32
- "@powerhousedao/ph-clint": "^0.1.0-dev.52",
33
- "@powerhousedao/ph-clint-app": "^0.1.0-dev.52",
34
- "@powerhousedao/ph-clint-dev": "^0.1.0-dev.52",
32
+ "@powerhousedao/ph-clint": "^0.1.0-dev.53",
33
+ "@powerhousedao/ph-clint-app": "^0.1.0-dev.53",
34
+ "@powerhousedao/ph-clint-dev": "^0.1.0-dev.53",
35
35
  "@powerhousedao/reactor": "6.0.0-dev.170",
36
36
  "@powerhousedao/reactor-api": "6.0.0-dev.170",
37
37
  "@powerhousedao/shared": "6.0.0-dev.170",