@powerhousedao/ph-clint-cli 0.1.0-dev.31 → 0.1.0-dev.33

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
@@ -46,10 +46,20 @@ export const cli = defineCli({
46
46
  'ph-clint-dev-agent': {
47
47
  name: 'PhClintDevAgent',
48
48
  sections: ['AgentBase.md'],
49
- skills: ['command-definition'],
49
+ skills: ['cli-setup', 'command-definition', 'service-definition'],
50
50
  },
51
51
  },
52
52
  skills: {
53
+ 'cli-setup': {
54
+ description: 'Set up a new CLI with defineCli, config schemas, entrypoint, and interactive mode',
55
+ inputSchema: z.object({
56
+ mode: z
57
+ .enum(['expert', 'discovery', 'one-shot'])
58
+ .default('expert')
59
+ .describe('Expert: align design decisions with the developer. Discovery: explain concepts step by step. One-shot: make all decisions autonomously'),
60
+ }),
61
+ instructionTemplate: 'Use your {{skillId}} skill in {{mode}} mode for: {{prompt}}',
62
+ },
53
63
  'command-definition': {
54
64
  description: 'Define commands with Zod schemas, execute functions, return values, and parameter prompting',
55
65
  inputSchema: z.object({
@@ -60,6 +70,16 @@ export const cli = defineCli({
60
70
  }),
61
71
  instructionTemplate: 'Use your {{skillId}} skill in {{mode}} mode for: {{prompt}}',
62
72
  },
73
+ 'service-definition': {
74
+ description: 'Define background services with readiness detection, preflight checks, and project scanning',
75
+ inputSchema: z.object({
76
+ mode: z
77
+ .enum(['expert', 'discovery', 'one-shot'])
78
+ .default('expert')
79
+ .describe('Expert: align design decisions with the developer. Discovery: explain concepts step by step. One-shot: make all decisions autonomously'),
80
+ }),
81
+ instructionTemplate: 'Use your {{skillId}} skill in {{mode}} mode for: {{prompt}}',
82
+ },
63
83
  },
64
84
  },
65
85
  // @clint:end prompts
@@ -72,7 +72,8 @@ export function buildCliPackageJson(spec) {
72
72
  }
73
73
  const scripts = {
74
74
  'build:skills': 'tsx scripts/build-skills.ts',
75
- build: 'pnpm build:skills && tsc',
75
+ 'build:manifest': 'build-manifest',
76
+ build: 'pnpm build:skills && tsc && pnpm build:manifest',
76
77
  dev: 'tsx src/main.ts',
77
78
  start: 'node dist/main.js',
78
79
  test: "NODE_OPTIONS='--experimental-vm-modules' jest --detectOpenHandles",
@@ -83,6 +84,16 @@ export function buildCliPackageJson(spec) {
83
84
  scripts['mastra:build'] = 'mastra build';
84
85
  scripts['mastra:start'] = 'mastra start';
85
86
  }
87
+ // Single-layout: publish scripts live in the CLI package.json (which IS the
88
+ // root). Split-layout gets these from root-package-json.ts instead.
89
+ if (!phAtLeast(powerhouse, 'Reactor')) {
90
+ scripts['publish:dev'] = 'ph-publish dev -c ./publish.config.js';
91
+ scripts['publish:staging'] = 'ph-publish staging -c ./publish.config.js';
92
+ scripts['publish:production'] = 'ph-publish production -c ./publish.config.js';
93
+ }
94
+ if (spec.deployment.serviceAnnouncement) {
95
+ scripts['test-service-registry'] = 'vetra-graphql-registry --withAuth';
96
+ }
86
97
  const pkg = {
87
98
  name: pkgName,
88
99
  version: spec.version,
@@ -46,6 +46,6 @@ export declare function getProfileFileBuilders(spec: ClintProjectSpec): FileBuil
46
46
  export declare const CLI_FILE_BUILDERS: FileBuilder[];
47
47
  export { buildCliPackageJson, buildCliTs, buildConfigTs, buildMainTs, buildTsconfigJson, buildJestConfigJs, buildEslintConfigJs, buildGitignore, buildMastraIndexTs, buildBuildSkillsScript, buildAgentBaseMd, buildAgentTs, buildDemoAgentTs, buildFrameworkGenTs, buildFrameworkTs, buildManifestJson, };
48
48
  export { buildRootPackageJson } from './root-package-json.js';
49
- export { buildPublishConfigTs } from './publish-config-ts.js';
49
+ export { buildPublishConfigJs } from './publish-config-js.js';
50
50
  export { buildReadme } from './readme-md.js';
51
51
  export { buildAppIndexTs } from './app-index-ts.js';
@@ -79,6 +79,6 @@ export const CLI_FILE_BUILDERS = [
79
79
  ];
80
80
  export { buildCliPackageJson, buildCliTs, buildConfigTs, buildMainTs, buildTsconfigJson, buildJestConfigJs, buildEslintConfigJs, buildGitignore, buildMastraIndexTs, buildBuildSkillsScript, buildAgentBaseMd, buildAgentTs, buildDemoAgentTs, buildFrameworkGenTs, buildFrameworkTs, buildManifestJson, };
81
81
  export { buildRootPackageJson } from './root-package-json.js';
82
- export { buildPublishConfigTs } from './publish-config-ts.js';
82
+ export { buildPublishConfigJs } from './publish-config-js.js';
83
83
  export { buildReadme } from './readme-md.js';
84
84
  export { buildAppIndexTs } from './app-index-ts.js';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Builds the root `publish.config.js`.
3
+ *
4
+ * Split-layout: a lockstep group with both app and cli packages.
5
+ * Single-layout: a single-package group at `.`.
6
+ */
7
+ import { type ClintProjectSpec } from '../../spec/types.js';
8
+ export declare function buildPublishConfigJs(spec: ClintProjectSpec): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Builds the root `publish.config.js`.
3
+ *
4
+ * Split-layout: a lockstep group with both app and cli packages.
5
+ * Single-layout: a single-package group at `.`.
6
+ */
7
+ import { phAtLeast } from '../../spec/types.js';
8
+ export function buildPublishConfigJs(spec) {
9
+ const split = phAtLeast(spec.features.powerhouse, 'Reactor');
10
+ // The publish pipeline appends the prerelease suffix (e.g. -dev.0), so we
11
+ // only store the base semver (M.m.p) here.
12
+ const baseVersion = spec.version.replace(/-.*$/, '');
13
+ const packages = split
14
+ ? `[
15
+ { path: '${spec.name}-app', category: 'app' },
16
+ { path: '${spec.name}-cli', category: 'cli' },
17
+ ]`
18
+ : `[
19
+ { path: '.', category: 'cli' },
20
+ ]`;
21
+ return `// Publish config — loaded by ph-clint's publish pipeline.
22
+ // definePublishConfig is an identity function; a plain export is equivalent.
23
+ export default {
24
+ groups: {
25
+ '${spec.name}': {
26
+ version: '${baseVersion}',
27
+ packages: ${packages},
28
+ },
29
+ },
30
+ };
31
+ `;
32
+ }
@@ -1,6 +1,8 @@
1
1
  /**
2
- * Builds the root `publish.config.ts` for split-layout projects.
3
- * Defines a single lockstep group containing both the app and cli packages.
2
+ * Builds the root `publish.config.ts`.
3
+ *
4
+ * Split-layout: a lockstep group with both app and cli packages.
5
+ * Single-layout: a single-package group at `.`.
4
6
  */
5
7
  import { type ClintProjectSpec } from '../../spec/types.js';
6
8
  export declare function buildPublishConfigTs(spec: ClintProjectSpec): string;
@@ -1,19 +1,30 @@
1
+ /**
2
+ * Builds the root `publish.config.ts`.
3
+ *
4
+ * Split-layout: a lockstep group with both app and cli packages.
5
+ * Single-layout: a single-package group at `.`.
6
+ */
7
+ import { phAtLeast } from '../../spec/types.js';
1
8
  export function buildPublishConfigTs(spec) {
2
- const app = `${spec.name}-app`;
3
- const cli = `${spec.name}-cli`;
9
+ const split = phAtLeast(spec.features.powerhouse, 'Reactor');
4
10
  // The publish pipeline appends the prerelease suffix (e.g. -dev.0), so we
5
11
  // only store the base semver (M.m.p) here.
6
12
  const baseVersion = spec.version.replace(/-.*$/, '');
13
+ const packages = split
14
+ ? `[
15
+ { path: '${spec.name}-app', category: 'app' },
16
+ { path: '${spec.name}-cli', category: 'cli' },
17
+ ]`
18
+ : `[
19
+ { path: '.', category: 'cli' },
20
+ ]`;
7
21
  return `// Publish config — loaded by ph-clint's publish pipeline.
8
22
  // definePublishConfig is an identity function; a plain export is equivalent.
9
23
  export default {
10
24
  groups: {
11
25
  '${spec.name}': {
12
26
  version: '${baseVersion}',
13
- packages: [
14
- { path: '${app}', category: 'app' },
15
- { path: '${cli}', category: 'cli' },
16
- ],
27
+ packages: ${packages},
17
28
  },
18
29
  },
19
30
  };
@@ -25,10 +25,13 @@ export function buildRootPackageJson(spec) {
25
25
  lint: prefix(cli, 'lint'),
26
26
  'app:dev': prefix(app, 'dev'),
27
27
  'cli:dev': prefix(cli, 'dev'),
28
- 'publish:dev': `${prefix(cli, 'exec ph-publish')} dev -c ./publish.config.ts`,
29
- 'publish:staging': `${prefix(cli, 'exec ph-publish')} staging -c ./publish.config.ts`,
30
- 'publish:production': `${prefix(cli, 'exec ph-publish')} production -c ./publish.config.ts`,
28
+ 'publish:dev': `${prefix(cli, 'exec ph-publish')} dev -c ../publish.config.js`,
29
+ 'publish:staging': `${prefix(cli, 'exec ph-publish')} staging -c ../publish.config.js`,
30
+ 'publish:production': `${prefix(cli, 'exec ph-publish')} production -c ../publish.config.js`,
31
31
  };
32
+ if (spec.deployment.serviceAnnouncement) {
33
+ scripts['test-service-registry'] = prefix(cli, 'test-service-registry');
34
+ }
32
35
  const pkg = {
33
36
  name: getPackageName(spec),
34
37
  version: spec.version,
@@ -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, buildPublishConfigTs, buildAppIndexTs, } from './builders/index.js';
38
+ import { CLI_FILE_BUILDERS, getProfileFileBuilders, buildReadme, buildRootPackageJson, buildPublishConfigJs, buildAppIndexTs, } from './builders/index.js';
39
39
  /**
40
40
  * Generate / reconcile a project at `targetDir` from the given spec.
41
41
  */
@@ -99,6 +99,13 @@ function planFiles(spec, targetDir) {
99
99
  absolutePath: readmeAbs,
100
100
  content: buildReadme(spec),
101
101
  });
102
+ // Publish config — always at the project root (both layouts).
103
+ const publishConfig = path.join(targetDir, 'publish.config.js');
104
+ planned.push({
105
+ relativePath: 'publish.config.js',
106
+ absolutePath: publishConfig,
107
+ content: buildPublishConfigJs(spec),
108
+ });
102
109
  // Split-layout only: root package.json + app placeholder files.
103
110
  if (split && appDir) {
104
111
  const rootPkg = path.join(targetDir, 'package.json');
@@ -107,12 +114,6 @@ function planFiles(spec, targetDir) {
107
114
  absolutePath: rootPkg,
108
115
  content: buildRootPackageJson(spec),
109
116
  });
110
- const publishConfig = path.join(targetDir, 'publish.config.ts');
111
- planned.push({
112
- relativePath: 'publish.config.ts',
113
- absolutePath: publishConfig,
114
- content: buildPublishConfigTs(spec),
115
- });
116
117
  const appGitkeep = path.join(appDir, '.gitkeep');
117
118
  planned.push({
118
119
  relativePath: path.relative(targetDir, appGitkeep),
@@ -36,7 +36,7 @@ export const clintProjectPublish = defineCommand({
36
36
  stdout(msg + '\n');
37
37
  };
38
38
  // 1. Resolve plan — discover config from the target dir, not process.cwd().
39
- const configFile = path.join(dir, 'publish.config.ts');
39
+ const configFile = path.join(dir, 'publish.config.js');
40
40
  const plan = await resolvePublishPlan({
41
41
  tag: input.tag,
42
42
  configPath: configFile,
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cli-setup
3
- description: "Cli Setup tasks"
3
+ description: "Set up a new CLI with defineCli, config schemas, entrypoint, and interactive mode"
4
4
  metadata:
5
5
  author: Powerhouse
6
6
  version: "1.0.0"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: service-definition
3
- description: "Service Definition tasks"
3
+ description: "Define background services with readiness detection, preflight checks, and project scanning"
4
4
  metadata:
5
5
  author: Powerhouse
6
6
  version: "1.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-clint-cli",
3
- "version": "0.1.0-dev.31",
3
+ "version": "0.1.0-dev.33",
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.31",
33
- "@powerhousedao/ph-clint-app": "^0.1.0-dev.31",
34
- "@powerhousedao/ph-clint-dev": "^0.1.0-dev.31",
32
+ "@powerhousedao/ph-clint": "^0.1.0-dev.33",
33
+ "@powerhousedao/ph-clint-app": "^0.1.0-dev.33",
34
+ "@powerhousedao/ph-clint-dev": "^0.1.0-dev.33",
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",