@powerhousedao/ph-clint-cli 0.1.0-dev.11 → 0.1.0-dev.110

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.
Files changed (110) hide show
  1. package/dist/cli.js +53 -16
  2. package/dist/codegen/index.d.ts +8 -36
  3. package/dist/codegen/index.js +6 -293
  4. package/dist/commands/clint-project-build.d.ts +73 -1
  5. package/dist/commands/clint-project-build.js +11 -28
  6. package/dist/commands/clint-project-init.d.ts +126 -10
  7. package/dist/commands/clint-project-init.js +72 -47
  8. package/dist/commands/clint-project-publish.d.ts +74 -1
  9. package/dist/commands/clint-project-publish.js +6 -4
  10. package/dist/commands/clint-project-regen.d.ts +73 -1
  11. package/dist/commands/clint-project-regen.js +26 -2
  12. package/dist/commands/clint-skills-sync.d.ts +82 -0
  13. package/dist/commands/clint-skills-sync.js +56 -0
  14. package/dist/framework.d.ts +318 -80
  15. package/dist/framework.gen.d.ts +50 -14
  16. package/dist/framework.js +1 -5
  17. package/{prompts/agent-profiles/AgentBase.md → dist/gen/agent-profiles/PhClintDevAgent.md} +1 -1
  18. package/dist/gen/skills/cli-setup/.cli-docs.md +135 -0
  19. package/dist/gen/skills/cli-setup/SKILL.md +125 -0
  20. package/dist/gen/skills/cli-setup/references/00.assess-cli-needs.md +53 -0
  21. package/dist/gen/skills/cli-setup/references/01.define-config-schema.md +78 -0
  22. package/dist/gen/skills/cli-setup/references/02.wire-cli.md +141 -0
  23. package/dist/gen/skills/cli-setup/references/03.add-entrypoint.md +128 -0
  24. package/dist/gen/skills/cli-setup/references/expected-outcome.md +3 -0
  25. package/dist/gen/skills/command-definition/.cli-docs.md +84 -0
  26. package/dist/gen/skills/command-definition/SKILL.md +99 -0
  27. package/dist/gen/skills/command-definition/references/00.assess-requirements.md +58 -0
  28. package/dist/gen/skills/command-definition/references/01.define-schema.md +72 -0
  29. package/dist/gen/skills/command-definition/references/02.implement-execute.md +118 -0
  30. package/dist/gen/skills/command-definition/references/03.add-prompting.md +54 -0
  31. package/dist/gen/skills/command-definition/references/expected-outcome.md +3 -0
  32. package/dist/gen/skills/service-definition/.cli-docs.md +214 -0
  33. package/dist/gen/skills/service-definition/SKILL.md +148 -0
  34. package/dist/gen/skills/service-definition/references/00.assess-service.md +69 -0
  35. package/dist/gen/skills/service-definition/references/01.define-service.md +166 -0
  36. package/dist/gen/skills/service-definition/references/02.add-preflight.md +132 -0
  37. package/dist/gen/skills/service-definition/references/03.add-project-scanner.md +82 -0
  38. package/dist/gen/skills/service-definition/references/04.wire-events.md +120 -0
  39. package/dist/gen/skills/service-definition/references/expected-outcome.md +3 -0
  40. package/dist/main.js +0 -0
  41. package/dist/services/clint-project.js +21 -0
  42. package/dist/spec/ensure-document.d.ts +17 -0
  43. package/dist/spec/ensure-document.js +56 -0
  44. package/dist/spec/file.d.ts +1 -4
  45. package/dist/spec/file.js +1 -34
  46. package/dist/spec/from-document.d.ts +4 -1
  47. package/dist/spec/from-document.js +4 -16
  48. package/dist/spec/types.d.ts +1 -62
  49. package/dist/spec/types.js +1 -112
  50. package/dist/triggers/publish-trigger.d.ts +77 -0
  51. package/dist/triggers/publish-trigger.js +137 -0
  52. package/dist/triggers/spec-change.d.ts +60 -22
  53. package/dist/triggers/spec-change.js +154 -101
  54. package/package.json +31 -31
  55. package/dist/codegen/builders/agent-base-md.d.ts +0 -5
  56. package/dist/codegen/builders/agent-base-md.js +0 -18
  57. package/dist/codegen/builders/agent-ts.d.ts +0 -9
  58. package/dist/codegen/builders/agent-ts.js +0 -34
  59. package/dist/codegen/builders/app-index-ts.d.ts +0 -18
  60. package/dist/codegen/builders/app-index-ts.js +0 -33
  61. package/dist/codegen/builders/build-skills-ts.d.ts +0 -4
  62. package/dist/codegen/builders/build-skills-ts.js +0 -37
  63. package/dist/codegen/builders/cli-package-json.d.ts +0 -8
  64. package/dist/codegen/builders/cli-package-json.js +0 -96
  65. package/dist/codegen/builders/cli-ts.d.ts +0 -7
  66. package/dist/codegen/builders/cli-ts.js +0 -132
  67. package/dist/codegen/builders/config-ts.d.ts +0 -8
  68. package/dist/codegen/builders/config-ts.js +0 -17
  69. package/dist/codegen/builders/eslint-config-js.d.ts +0 -4
  70. package/dist/codegen/builders/eslint-config-js.js +0 -13
  71. package/dist/codegen/builders/framework-gen-ts.d.ts +0 -20
  72. package/dist/codegen/builders/framework-gen-ts.js +0 -62
  73. package/dist/codegen/builders/framework-ts.d.ts +0 -21
  74. package/dist/codegen/builders/framework-ts.js +0 -74
  75. package/dist/codegen/builders/gitignore.d.ts +0 -4
  76. package/dist/codegen/builders/gitignore.js +0 -18
  77. package/dist/codegen/builders/index.d.ts +0 -44
  78. package/dist/codegen/builders/index.js +0 -61
  79. package/dist/codegen/builders/jest-config-js.d.ts +0 -4
  80. package/dist/codegen/builders/jest-config-js.js +0 -19
  81. package/dist/codegen/builders/main-ts.d.ts +0 -5
  82. package/dist/codegen/builders/main-ts.js +0 -13
  83. package/dist/codegen/builders/mastra-index-ts.d.ts +0 -8
  84. package/dist/codegen/builders/mastra-index-ts.js +0 -30
  85. package/dist/codegen/builders/publish-config-ts.d.ts +0 -6
  86. package/dist/codegen/builders/publish-config-ts.js +0 -18
  87. package/dist/codegen/builders/readme-md.d.ts +0 -5
  88. package/dist/codegen/builders/readme-md.js +0 -44
  89. package/dist/codegen/builders/root-package-json.d.ts +0 -10
  90. package/dist/codegen/builders/root-package-json.js +0 -40
  91. package/dist/codegen/builders/tsconfig-json.d.ts +0 -4
  92. package/dist/codegen/builders/tsconfig-json.js +0 -22
  93. package/dist/codegen/exec.d.ts +0 -20
  94. package/dist/codegen/exec.js +0 -41
  95. package/dist/codegen/hashes.d.ts +0 -6
  96. package/dist/codegen/hashes.js +0 -60
  97. package/dist/codegen/markers.d.ts +0 -36
  98. package/dist/codegen/markers.js +0 -86
  99. package/dist/codegen/migrate/flat-to-split.d.ts +0 -15
  100. package/dist/codegen/migrate/flat-to-split.js +0 -119
  101. package/dist/codegen/scaffold.d.ts +0 -34
  102. package/dist/codegen/scaffold.js +0 -60
  103. package/dist/codegen/write.d.ts +0 -6
  104. package/dist/codegen/write.js +0 -32
  105. package/dist/commands/init.d.ts +0 -57
  106. package/dist/commands/init.js +0 -168
  107. package/dist/commands/regen.d.ts +0 -18
  108. package/dist/commands/regen.js +0 -68
  109. package/prompts/skills-ext/.gitkeep +0 -0
  110. package/prompts/skills-tpl/.gitkeep +0 -0
@@ -1,7 +0,0 @@
1
- /**
2
- * Builds `src/cli.ts` — the defineCli() call with feature blocks guarded by
3
- * `@clint:begin`/`@clint:end` markers so the code generator can patch
4
- * specific regions on subsequent runs (delta mode — future phase).
5
- */
6
- import { type ClintProjectSpec } from '../../spec/types.js';
7
- export declare function buildCliTs(spec: ClintProjectSpec): string;
@@ -1,132 +0,0 @@
1
- export function buildCliTs(spec) {
2
- const { mastra, routine, powerhouse } = spec.features;
3
- const lines = [];
4
- lines.push('/**');
5
- lines.push(' * CLI definition.');
6
- lines.push(' *');
7
- lines.push(' * Generated by ph-clint. Regions bracketed by @clint:begin/@clint:end');
8
- lines.push(' * markers are rewritten by ph-clint when the project spec changes.');
9
- lines.push(' * Everything outside the markers is user-editable and preserved.');
10
- lines.push(' */');
11
- if (powerhouse.enabled) {
12
- lines.push(`import path from 'node:path';`);
13
- lines.push(`import { existsSync } from 'node:fs';`);
14
- lines.push(`import { defineCli, buildDefaultReactor } from '@powerhousedao/ph-clint';`);
15
- }
16
- else {
17
- lines.push(`import { defineCli } from '@powerhousedao/ph-clint';`);
18
- }
19
- lines.push(`import { CLI_NAME, CLI_VERSION${powerhouse.enabled ? ', CLI_ROOT' : ''} } from './config.js';`);
20
- lines.push(`import { configSchema, secretsSchema } from './framework.js';`);
21
- lines.push('');
22
- lines.push('// @clint:begin imports');
23
- if (powerhouse.enabled) {
24
- lines.push(`import { documentModels } from '${spec.name}-app';`);
25
- }
26
- if (mastra.enabled) {
27
- lines.push(`import { createAgent } from './agents/agent.js';`);
28
- }
29
- lines.push('// @clint:end imports');
30
- lines.push('');
31
- if (powerhouse.enabled) {
32
- lines.push(`const appDir = path.resolve(CLI_ROOT, '../${spec.name}-app');`);
33
- lines.push('');
34
- if (powerhouse.connect) {
35
- lines.push('function resolveConnectAssets(dir: string): string | undefined {');
36
- lines.push(" const assetsDir = path.join(dir, 'dist', 'connect');");
37
- lines.push(" return existsSync(path.join(assetsDir, 'index.html')) ? assetsDir : undefined;");
38
- lines.push('}');
39
- lines.push('');
40
- }
41
- }
42
- lines.push('export const cli = defineCli({');
43
- lines.push(' name: CLI_NAME,');
44
- lines.push(' version: CLI_VERSION,');
45
- lines.push(' description: `${CLI_NAME} v${CLI_VERSION}`,');
46
- lines.push(' configSchema,');
47
- lines.push(' secretsSchema,');
48
- lines.push('');
49
- lines.push(' // @clint:begin commands');
50
- lines.push(' commands: [],');
51
- lines.push(' // @clint:end commands');
52
- lines.push('');
53
- lines.push(' // @clint:begin services');
54
- lines.push(' services: [],');
55
- lines.push(' // @clint:end services');
56
- lines.push('');
57
- lines.push(' // @clint:begin triggers');
58
- if (routine.enabled) {
59
- lines.push(' triggers: [],');
60
- }
61
- else {
62
- lines.push(' triggers: [],');
63
- }
64
- lines.push(' // @clint:end triggers');
65
- lines.push('');
66
- lines.push(' // @clint:begin prompts');
67
- lines.push(' prompts: {');
68
- lines.push(' sources: [],');
69
- lines.push(' agents: {},');
70
- lines.push(' skills: {},');
71
- lines.push(' },');
72
- lines.push(' // @clint:end prompts');
73
- lines.push('');
74
- lines.push(' // @clint:begin events');
75
- lines.push(' events: {},');
76
- lines.push(' // @clint:end events');
77
- lines.push('');
78
- lines.push(' // @clint:begin interactive');
79
- lines.push(' interactive: {');
80
- const ctxArgs = [];
81
- if (powerhouse.enabled && (powerhouse.switchboard || powerhouse.connect)) {
82
- ctxArgs.push('config');
83
- }
84
- ctxArgs.push('workdir');
85
- lines.push(` welcome: ({ ${ctxArgs.join(', ')} }) =>`);
86
- lines.push(' [');
87
- lines.push(' `${CLI_NAME} v${CLI_VERSION}`,');
88
- lines.push(' `Workdir: ${workdir}`,');
89
- if (powerhouse.enabled && powerhouse.switchboard) {
90
- lines.push(' `Switchboard: http://localhost:${config.switchboardPort}`,');
91
- }
92
- if (powerhouse.enabled && powerhouse.connect) {
93
- lines.push(' `Connect: http://localhost:${config.connectPort}`,');
94
- }
95
- lines.push(" '',");
96
- if (mastra.enabled) {
97
- lines.push(" 'Type a message to talk to the agent, or /help for commands.',");
98
- }
99
- else {
100
- lines.push(" 'Type /help for commands.',");
101
- }
102
- lines.push(" ].join('\\n'),");
103
- lines.push(' },');
104
- lines.push(' // @clint:end interactive');
105
- lines.push('});');
106
- lines.push('');
107
- lines.push('// @clint:begin reactor');
108
- if (powerhouse.enabled) {
109
- lines.push('cli.configureReactor({');
110
- lines.push(' create: (ctx) =>');
111
- lines.push(' buildDefaultReactor(ctx, {');
112
- lines.push(' documentModels,');
113
- lines.push(` drive: { name: '${spec.name}' },`);
114
- lines.push(' }),');
115
- lines.push(` switchboard: { enabled: ${String(powerhouse.switchboard)} },`);
116
- if (powerhouse.connect) {
117
- lines.push(` connect: { enabled: true, workdir: appDir, assetsDir: resolveConnectAssets(appDir) },`);
118
- }
119
- else {
120
- lines.push(` connect: { enabled: false },`);
121
- }
122
- lines.push('});');
123
- }
124
- lines.push('// @clint:end reactor');
125
- lines.push('');
126
- lines.push('// @clint:begin mastra');
127
- if (mastra.enabled) {
128
- lines.push('cli.configureAgent(createAgent);');
129
- }
130
- lines.push('// @clint:end mastra');
131
- return lines.join('\n') + '\n';
132
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Builds `src/config.ts` — CLI identity constants (name, version, project
3
- * root path). The Zod `configSchema` / `secretsSchema` are emitted by
4
- * `buildFrameworkTs` into `src/framework.ts` (user-owned, init-only) so users
5
- * can extend them without fighting the generator.
6
- */
7
- import { type ClintProjectSpec } from '../../spec/types.js';
8
- export declare function buildConfigTs(spec: ClintProjectSpec): string;
@@ -1,17 +0,0 @@
1
- export function buildConfigTs(spec) {
2
- const hasCustomBin = !!spec.bin;
3
- const lines = [];
4
- lines.push(`import { readPackageInfo } from '@powerhousedao/ph-clint';`);
5
- lines.push('');
6
- lines.push('const pkg = readPackageInfo(import.meta.url);');
7
- lines.push('');
8
- lines.push('export const CLI_ROOT = pkg.root;');
9
- if (hasCustomBin) {
10
- lines.push(`export const CLI_NAME = '${spec.bin}';`);
11
- }
12
- else {
13
- lines.push(`export const CLI_NAME = pkg.name.replace(/-cli$/, '');`);
14
- }
15
- lines.push('export const CLI_VERSION = pkg.version;');
16
- return lines.join('\n') + '\n';
17
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Builds `eslint.config.js` for the CLI — placeholder flat config.
3
- */
4
- export declare function buildEslintConfigJs(): string;
@@ -1,13 +0,0 @@
1
- /**
2
- * Builds `eslint.config.js` for the CLI — placeholder flat config.
3
- */
4
- export function buildEslintConfigJs() {
5
- return [
6
- '// @clint:begin eslint',
7
- '// Placeholder ESLint flat config — replaced by codegen when the',
8
- "// project's lint stack is configured.",
9
- 'export default [];',
10
- '// @clint:end eslint',
11
- '',
12
- ].join('\n');
13
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Builds `src/framework.gen.ts` — the fully machine-owned half of the
3
- * typed-binding split. Regenerated on every `init` and `update`; holds the
4
- * `defineRegistry([...] as const)` call that describes which document models
5
- * are bound into `framework.ts`'s typed factories.
6
- *
7
- * Kept deliberately small: this file exports only `registry` and the
8
- * `Registry` type. The `createTypes` call lives in `framework.ts` (the
9
- * user-owned half) so `configSchema` edits stay local and we avoid an import
10
- * cycle between the two files.
11
- *
12
- * Emitted only when Powerhouse is enabled — flat-layout impls have no
13
- * reactor package to import modules from and bind `createTypes` directly in
14
- * `framework.ts`. When Powerhouse is on but no `documentTypes` are declared,
15
- * we still emit this file with an empty `defineRegistry([])` so impl code's
16
- * `import { registry } from './framework.gen.js'` keeps resolving across
17
- * regens.
18
- */
19
- import { type ClintProjectSpec } from '../../spec/types.js';
20
- export declare function buildFrameworkGenTs(spec: ClintProjectSpec): string | null;
@@ -1,62 +0,0 @@
1
- /**
2
- * Builds `src/framework.gen.ts` — the fully machine-owned half of the
3
- * typed-binding split. Regenerated on every `init` and `update`; holds the
4
- * `defineRegistry([...] as const)` call that describes which document models
5
- * are bound into `framework.ts`'s typed factories.
6
- *
7
- * Kept deliberately small: this file exports only `registry` and the
8
- * `Registry` type. The `createTypes` call lives in `framework.ts` (the
9
- * user-owned half) so `configSchema` edits stay local and we avoid an import
10
- * cycle between the two files.
11
- *
12
- * Emitted only when Powerhouse is enabled — flat-layout impls have no
13
- * reactor package to import modules from and bind `createTypes` directly in
14
- * `framework.ts`. When Powerhouse is on but no `documentTypes` are declared,
15
- * we still emit this file with an empty `defineRegistry([])` so impl code's
16
- * `import { registry } from './framework.gen.js'` keeps resolving across
17
- * regens.
18
- */
19
- import { getDocumentTypeModuleName, } from '../../spec/types.js';
20
- /** Local package name of the reactor package for this project. */
21
- function appPackageName(spec) {
22
- return `${spec.name}-app`;
23
- }
24
- export function buildFrameworkGenTs(spec) {
25
- if (!spec.features.powerhouse.enabled)
26
- return null;
27
- const pkg = appPackageName(spec);
28
- const entries = spec.documentTypes.map((docType) => ({
29
- docType,
30
- name: getDocumentTypeModuleName(docType),
31
- }));
32
- const lines = [];
33
- lines.push('/**');
34
- lines.push(' * THIS FILE IS GENERATED BY ph-clint-cli. DO NOT EDIT.');
35
- lines.push(' *');
36
- lines.push(' * Regenerated on every `ph-clint clint-project-regen` and on every spec-change');
37
- lines.push(' * tick. Put custom bindings in `framework.ts`, not here — edits to');
38
- lines.push(' * this file will be overwritten.');
39
- lines.push(' */');
40
- lines.push(`import { defineRegistry } from '@powerhousedao/ph-clint';`);
41
- for (const e of entries) {
42
- lines.push(`import { ${e.name} } from '${pkg}';`);
43
- }
44
- lines.push('');
45
- lines.push('/**');
46
- lines.push(' * Typed document registry derived from the reactor package\'s document models.');
47
- lines.push(' * Regenerated whenever the spec\'s `documentTypes` list changes.');
48
- lines.push(' */');
49
- if (entries.length === 0) {
50
- lines.push('export const registry = defineRegistry([] as const);');
51
- }
52
- else {
53
- lines.push('export const registry = defineRegistry([');
54
- for (const e of entries) {
55
- lines.push(` ${e.name},`);
56
- }
57
- lines.push('] as const);');
58
- }
59
- lines.push('');
60
- lines.push('export type Registry = typeof registry;');
61
- return lines.join('\n') + '\n';
62
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Builds `src/framework.ts` — the user-owned half of the typed-binding split.
3
- *
4
- * Emitted **only on create**. Once the file exists, codegen never overwrites
5
- * it: users are expected to extend `configSchema` and `secretsSchema` here,
6
- * and those edits must survive regens.
7
- *
8
- * Behavior differs by layout:
9
- *
10
- * - **Powerhouse enabled** — this file declares `configSchema`/`secretsSchema`
11
- * and re-exports `registry`, `defineCommand`, `defineTrigger`,
12
- * `defineService`, and `createDocumentChangeTrigger` from the companion
13
- * `framework.gen.ts`. Adding a document type to the spec regenerates
14
- * `framework.gen.ts`; this file keeps resolving its re-exports unchanged.
15
- *
16
- * - **Powerhouse disabled** — no reactor package exists to register modules
17
- * against, so this file binds `createTypes({ configSchema })` directly and
18
- * exports the typed factories from here. No `framework.gen.ts` is emitted.
19
- */
20
- import { type ClintProjectSpec } from '../../spec/types.js';
21
- export declare function buildFrameworkTs(spec: ClintProjectSpec): string;
@@ -1,74 +0,0 @@
1
- export function buildFrameworkTs(spec) {
2
- const { mastra, powerhouse } = spec.features;
3
- const hasGen = powerhouse.enabled;
4
- const lines = [];
5
- lines.push('/**');
6
- lines.push(' * Per-CLI typed framework binding.');
7
- lines.push(' *');
8
- lines.push(' * This file is USER-OWNED. ph-clint-cli emits it once at project');
9
- lines.push(' * creation and never overwrites it afterwards — edit `configSchema`');
10
- lines.push(' * and `secretsSchema` freely.');
11
- if (hasGen) {
12
- lines.push(' *');
13
- lines.push(' * Typed factories (`defineCommand`, `defineTrigger`, ...) and the');
14
- lines.push(' * document `registry` come from `framework.gen.ts`, which IS');
15
- lines.push(' * regenerated whenever the spec\'s `documentTypes` list changes.');
16
- }
17
- lines.push(' */');
18
- lines.push(`import { z } from 'zod';`);
19
- lines.push(`import { createTypes } from '@powerhousedao/ph-clint';`);
20
- if (hasGen) {
21
- lines.push(`import { registry } from './framework.gen.js';`);
22
- }
23
- lines.push('');
24
- lines.push('export const configSchema = z.object({');
25
- if (mastra.enabled) {
26
- lines.push(" model: z.string().default('anthropic/claude-haiku-4-5').describe('LLM model to use'),");
27
- }
28
- // Ports are derived from CLI name by resolveReactorDefaults() — no config fields needed.
29
- // Override via switchboard.port / connect.port in configureReactor() if required.
30
- lines.push(' // Add your own config fields here — this file survives regens.');
31
- lines.push('});');
32
- lines.push('');
33
- lines.push('export const secretsSchema = z.object({');
34
- if (mastra.enabled) {
35
- lines.push(" apiKey: z.string().optional().describe('LLM API key'),");
36
- }
37
- lines.push('});');
38
- lines.push('');
39
- lines.push('export type Config = z.infer<typeof configSchema> &');
40
- lines.push(' z.infer<typeof secretsSchema>;');
41
- lines.push('');
42
- lines.push('const fullConfigSchema = configSchema.merge(secretsSchema);');
43
- lines.push('');
44
- if (hasGen) {
45
- lines.push('export const {');
46
- lines.push(' defineCommand,');
47
- lines.push(' defineTrigger,');
48
- lines.push(' defineService,');
49
- lines.push(' createDocumentChangeTrigger,');
50
- lines.push('} = createTypes({');
51
- lines.push(' configSchema: fullConfigSchema,');
52
- lines.push(' registry,');
53
- lines.push('});');
54
- lines.push('');
55
- lines.push(`export { registry } from './framework.gen.js';`);
56
- lines.push(`export type { Registry } from './framework.gen.js';`);
57
- }
58
- else {
59
- lines.push('/**');
60
- lines.push(' * No reactor package — bind `createTypes` directly so');
61
- lines.push(' * `defineCommand` / `defineTrigger` / `defineService` still pick up');
62
- lines.push(' * the typed config. Enable `features.powerhouse` in the project spec');
63
- lines.push(' * and codegen will switch these exports to a registry-backed');
64
- lines.push(' * `framework.gen.ts`.');
65
- lines.push(' */');
66
- lines.push('export const {');
67
- lines.push(' defineCommand,');
68
- lines.push(' defineTrigger,');
69
- lines.push(' defineService,');
70
- lines.push(' createDocumentChangeTrigger,');
71
- lines.push('} = createTypes({ configSchema: fullConfigSchema });');
72
- }
73
- return lines.join('\n') + '\n';
74
- }
@@ -1,4 +0,0 @@
1
- /**
2
- * Builds `.gitignore` for the CLI.
3
- */
4
- export declare function buildGitignore(): string;
@@ -1,18 +0,0 @@
1
- /**
2
- * Builds `.gitignore` for the CLI.
3
- */
4
- export function buildGitignore() {
5
- return [
6
- 'node_modules/',
7
- 'dist/',
8
- 'gen/',
9
- '.mastra/',
10
- '.ph/',
11
- 'coverage/',
12
- '*.tsbuildinfo',
13
- '*.db',
14
- '*.db-shm',
15
- '*.db-wal',
16
- '',
17
- ].join('\n');
18
- }
@@ -1,44 +0,0 @@
1
- /**
2
- * Registry of file builders. Each entry knows its own relative path (within
3
- * the CLI sub-tree) and a function that builds its content from the spec.
4
- *
5
- * Orchestrated by `codegen/index.ts` — it walks this registry, adjusts paths
6
- * for flat vs split layouts, and writes the files.
7
- */
8
- import { buildCliPackageJson } from './cli-package-json.js';
9
- import { buildCliTs } from './cli-ts.js';
10
- import { buildConfigTs } from './config-ts.js';
11
- import { buildMainTs } from './main-ts.js';
12
- import { buildTsconfigJson } from './tsconfig-json.js';
13
- import { buildJestConfigJs } from './jest-config-js.js';
14
- import { buildEslintConfigJs } from './eslint-config-js.js';
15
- import { buildGitignore } from './gitignore.js';
16
- import { buildMastraIndexTs } from './mastra-index-ts.js';
17
- import { buildBuildSkillsScript } from './build-skills-ts.js';
18
- import { buildAgentBaseMd } from './agent-base-md.js';
19
- import { buildAgentTs } from './agent-ts.js';
20
- import { buildFrameworkGenTs } from './framework-gen-ts.js';
21
- import { buildFrameworkTs } from './framework-ts.js';
22
- import { type ClintProjectSpec } from '../../spec/types.js';
23
- /**
24
- * A spec-driven file builder. Returns `null` from `build` to indicate the
25
- * file should not be emitted for the given spec.
26
- */
27
- export interface FileBuilder {
28
- /** Path relative to the CLI root (flat or `{name}-cli/`). */
29
- relativePath: string;
30
- build(spec: ClintProjectSpec): string | null;
31
- /**
32
- * When true, this file is only emitted on `mode: 'create'`. In `update`
33
- * mode the planner ignores the builder entirely, leaving any on-disk
34
- * version untouched regardless of hash state. Used for files that carry
35
- * user-owned hand edits (e.g. `src/framework.ts`'s `configSchema`).
36
- */
37
- initOnly?: boolean;
38
- }
39
- export declare const CLI_FILE_BUILDERS: FileBuilder[];
40
- export { buildCliPackageJson, buildCliTs, buildConfigTs, buildMainTs, buildTsconfigJson, buildJestConfigJs, buildEslintConfigJs, buildGitignore, buildMastraIndexTs, buildBuildSkillsScript, buildAgentBaseMd, buildAgentTs, buildFrameworkGenTs, buildFrameworkTs, };
41
- export { buildRootPackageJson } from './root-package-json.js';
42
- export { buildPublishConfigTs } from './publish-config-ts.js';
43
- export { buildReadme } from './readme-md.js';
44
- export { buildAppIndexTs } from './app-index-ts.js';
@@ -1,61 +0,0 @@
1
- /**
2
- * Registry of file builders. Each entry knows its own relative path (within
3
- * the CLI sub-tree) and a function that builds its content from the spec.
4
- *
5
- * Orchestrated by `codegen/index.ts` — it walks this registry, adjusts paths
6
- * for flat vs split layouts, and writes the files.
7
- */
8
- import { buildCliPackageJson } from './cli-package-json.js';
9
- import { buildCliTs } from './cli-ts.js';
10
- import { buildConfigTs } from './config-ts.js';
11
- import { buildMainTs } from './main-ts.js';
12
- import { buildTsconfigJson } from './tsconfig-json.js';
13
- import { buildJestConfigJs } from './jest-config-js.js';
14
- import { buildEslintConfigJs } from './eslint-config-js.js';
15
- import { buildGitignore } from './gitignore.js';
16
- import { buildMastraIndexTs } from './mastra-index-ts.js';
17
- import { buildBuildSkillsScript } from './build-skills-ts.js';
18
- import { buildAgentBaseMd } from './agent-base-md.js';
19
- import { buildAgentTs } from './agent-ts.js';
20
- import { buildFrameworkGenTs } from './framework-gen-ts.js';
21
- import { buildFrameworkTs } from './framework-ts.js';
22
- export const CLI_FILE_BUILDERS = [
23
- { relativePath: 'package.json', build: buildCliPackageJson },
24
- { relativePath: 'tsconfig.json', build: () => buildTsconfigJson() },
25
- { relativePath: 'jest.config.js', build: () => buildJestConfigJs() },
26
- { relativePath: 'eslint.config.js', build: () => buildEslintConfigJs() },
27
- { relativePath: '.gitignore', build: () => buildGitignore() },
28
- { relativePath: 'src/main.ts', build: () => buildMainTs() },
29
- { relativePath: 'src/cli.ts', build: buildCliTs },
30
- { relativePath: 'src/config.ts', build: buildConfigTs },
31
- // User-owned; init-only. Holds `configSchema` + `secretsSchema` edits.
32
- { relativePath: 'src/framework.ts', build: buildFrameworkTs, initOnly: true },
33
- // Machine-owned; regenerated on every run. Null when no document types.
34
- { relativePath: 'src/framework.gen.ts', build: buildFrameworkGenTs },
35
- { relativePath: 'src/mastra/index.ts', build: buildMastraIndexTs },
36
- { relativePath: 'scripts/build-skills.ts', build: () => buildBuildSkillsScript() },
37
- { relativePath: 'prompts/agent-profiles/AgentBase.md', build: buildAgentBaseMd },
38
- {
39
- relativePath: 'src/agents/agent.ts',
40
- build: (spec) => (spec.features.mastra.enabled ? buildAgentTs(spec) : null),
41
- },
42
- // Gitkeep placeholders so directories are tracked in git when otherwise empty.
43
- { relativePath: 'src/commands/.gitkeep', build: () => '' },
44
- { relativePath: 'src/services/.gitkeep', build: () => '' },
45
- {
46
- relativePath: 'src/triggers/.gitkeep',
47
- build: (spec) => (spec.features.routine.enabled ? '' : ''),
48
- },
49
- {
50
- relativePath: 'src/agents/.gitkeep',
51
- build: (spec) => (spec.features.mastra.enabled ? null : ''),
52
- },
53
- { relativePath: 'prompts/skills-tpl/.gitkeep', build: () => '' },
54
- { relativePath: 'prompts/skills-ext/.gitkeep', build: () => '' },
55
- { relativePath: 'tests/.gitkeep', build: () => '' },
56
- ];
57
- export { buildCliPackageJson, buildCliTs, buildConfigTs, buildMainTs, buildTsconfigJson, buildJestConfigJs, buildEslintConfigJs, buildGitignore, buildMastraIndexTs, buildBuildSkillsScript, buildAgentBaseMd, buildAgentTs, buildFrameworkGenTs, buildFrameworkTs, };
58
- export { buildRootPackageJson } from './root-package-json.js';
59
- export { buildPublishConfigTs } from './publish-config-ts.js';
60
- export { buildReadme } from './readme-md.js';
61
- export { buildAppIndexTs } from './app-index-ts.js';
@@ -1,4 +0,0 @@
1
- /**
2
- * Builds `jest.config.js` for the CLI.
3
- */
4
- export declare function buildJestConfigJs(): string;
@@ -1,19 +0,0 @@
1
- /**
2
- * Builds `jest.config.js` for the CLI.
3
- */
4
- export function buildJestConfigJs() {
5
- return [
6
- "/** @type {import('jest').Config} */",
7
- 'export default {',
8
- " extensionsToTreatAsEsm: ['.ts'],",
9
- ' transform: {',
10
- " '^.+\\\\.ts$': ['ts-jest', { useESM: true }],",
11
- ' },',
12
- ' moduleNameMapper: {',
13
- " '^(\\\\.{1,2}/.*)\\\\.js$': '$1',",
14
- ' },',
15
- " testMatch: ['**/tests/**/*.test.ts'],",
16
- '};',
17
- '',
18
- ].join('\n');
19
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Builds `src/main.ts` — the bin entry point. Always identical regardless
3
- * of feature toggles.
4
- */
5
- export declare function buildMainTs(): string;
@@ -1,13 +0,0 @@
1
- /**
2
- * Builds `src/main.ts` — the bin entry point. Always identical regardless
3
- * of feature toggles.
4
- */
5
- export function buildMainTs() {
6
- return [
7
- '#!/usr/bin/env node',
8
- "import { cli } from './cli.js';",
9
- '',
10
- 'cli.run(process.argv);',
11
- '',
12
- ].join('\n');
13
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * Builds `src/mastra/index.ts` — Mastra Studio entry point.
3
- *
4
- * When Mastra is off, emit a no-op placeholder so the directory still exists
5
- * and `mastra dev` fails predictably rather than importing partial code.
6
- */
7
- import { type ClintProjectSpec } from '../../spec/types.js';
8
- export declare function buildMastraIndexTs(spec: ClintProjectSpec): string;
@@ -1,30 +0,0 @@
1
- export function buildMastraIndexTs(spec) {
2
- const { mastra } = spec.features;
3
- if (!mastra.enabled) {
4
- return [
5
- '/**',
6
- ' * Mastra Studio entry point — placeholder. Enable the `mastra` feature to',
7
- ' * populate this file. Until then `mastra:*` scripts are effectively no-ops.',
8
- ' */',
9
- '// @clint:begin mastra-index',
10
- 'export {};',
11
- '// @clint:end mastra-index',
12
- '',
13
- ].join('\n');
14
- }
15
- // When Mastra is enabled but we still emit the demo `AgentProvider` shim
16
- // (not a real `@mastra/core` Agent), there is no `mastra` export yet —
17
- // `mastra dev` will surface a helpful message once you wire a real Agent.
18
- return [
19
- '/**',
20
- ' * Mastra Studio entry point for `mastra dev` / `mastra build` / `mastra start`.',
21
- ' *',
22
- " * Re-export a configured `@mastra/core` Mastra instance from here once you",
23
- " * replace the demo createAgent shim with a real Mastra Agent.",
24
- ' */',
25
- '// @clint:begin mastra-index',
26
- 'export {};',
27
- '// @clint:end mastra-index',
28
- '',
29
- ].join('\n');
30
- }
@@ -1,6 +0,0 @@
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.
4
- */
5
- import { type ClintProjectSpec } from '../../spec/types.js';
6
- export declare function buildPublishConfigTs(spec: ClintProjectSpec): string;
@@ -1,18 +0,0 @@
1
- export function buildPublishConfigTs(spec) {
2
- const app = `${spec.name}-app`;
3
- const cli = `${spec.name}-cli`;
4
- return `import { definePublishConfig } from '@powerhousedao/ph-clint-dev/publish';
5
-
6
- export default definePublishConfig({
7
- groups: {
8
- '${spec.name}': {
9
- version: '${spec.version}',
10
- packages: [
11
- { path: '${app}', category: 'app' },
12
- { path: '${cli}', category: 'cli' },
13
- ],
14
- },
15
- },
16
- });
17
- `;
18
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Builds the project README for a freshly-generated ph-clint project.
3
- */
4
- import { type ClintProjectSpec } from '../../spec/types.js';
5
- export declare function buildReadme(spec: ClintProjectSpec): string;