@powerhousedao/ph-clint-cli 0.0.1

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 (65) hide show
  1. package/README.md +84 -0
  2. package/dist/agents/clint-agent.d.ts +12 -0
  3. package/dist/agents/clint-agent.js +42 -0
  4. package/dist/cli.d.ts +1 -0
  5. package/dist/cli.js +122 -0
  6. package/dist/codegen/index.d.ts +11 -0
  7. package/dist/codegen/index.js +11 -0
  8. package/dist/commands/clint-project-build.d.ts +83 -0
  9. package/dist/commands/clint-project-build.js +34 -0
  10. package/dist/commands/clint-project-init.d.ts +177 -0
  11. package/dist/commands/clint-project-init.js +193 -0
  12. package/dist/commands/clint-project-publish.d.ts +92 -0
  13. package/dist/commands/clint-project-publish.js +73 -0
  14. package/dist/commands/clint-project-regen.d.ts +94 -0
  15. package/dist/commands/clint-project-regen.js +92 -0
  16. package/dist/commands/clint-skills-sync.d.ts +86 -0
  17. package/dist/commands/clint-skills-sync.js +56 -0
  18. package/dist/config.d.ts +3 -0
  19. package/dist/config.js +5 -0
  20. package/dist/framework.d.ts +501 -0
  21. package/dist/framework.gen.d.ts +77 -0
  22. package/dist/framework.gen.js +16 -0
  23. package/dist/framework.js +37 -0
  24. package/dist/gen/agent-profiles/PhClintDevAgent.md +13 -0
  25. package/dist/gen/skills/cli-setup/.cli-docs.md +135 -0
  26. package/dist/gen/skills/cli-setup/SKILL.md +125 -0
  27. package/dist/gen/skills/cli-setup/references/00.assess-cli-needs.md +53 -0
  28. package/dist/gen/skills/cli-setup/references/01.define-config-schema.md +78 -0
  29. package/dist/gen/skills/cli-setup/references/02.wire-cli.md +141 -0
  30. package/dist/gen/skills/cli-setup/references/03.add-entrypoint.md +128 -0
  31. package/dist/gen/skills/cli-setup/references/expected-outcome.md +3 -0
  32. package/dist/gen/skills/command-definition/.cli-docs.md +84 -0
  33. package/dist/gen/skills/command-definition/SKILL.md +99 -0
  34. package/dist/gen/skills/command-definition/references/00.assess-requirements.md +58 -0
  35. package/dist/gen/skills/command-definition/references/01.define-schema.md +72 -0
  36. package/dist/gen/skills/command-definition/references/02.implement-execute.md +118 -0
  37. package/dist/gen/skills/command-definition/references/03.add-prompting.md +54 -0
  38. package/dist/gen/skills/command-definition/references/expected-outcome.md +3 -0
  39. package/dist/gen/skills/service-definition/.cli-docs.md +214 -0
  40. package/dist/gen/skills/service-definition/SKILL.md +148 -0
  41. package/dist/gen/skills/service-definition/references/00.assess-service.md +69 -0
  42. package/dist/gen/skills/service-definition/references/01.define-service.md +166 -0
  43. package/dist/gen/skills/service-definition/references/02.add-preflight.md +132 -0
  44. package/dist/gen/skills/service-definition/references/03.add-project-scanner.md +82 -0
  45. package/dist/gen/skills/service-definition/references/04.wire-events.md +120 -0
  46. package/dist/gen/skills/service-definition/references/expected-outcome.md +3 -0
  47. package/dist/main.d.ts +2 -0
  48. package/dist/main.js +3 -0
  49. package/dist/mastra/index.d.ts +10 -0
  50. package/dist/mastra/index.js +11 -0
  51. package/dist/services/clint-project.d.ts +1 -0
  52. package/dist/services/clint-project.js +68 -0
  53. package/dist/spec/ensure-document.d.ts +17 -0
  54. package/dist/spec/ensure-document.js +56 -0
  55. package/dist/spec/file.d.ts +1 -0
  56. package/dist/spec/file.js +1 -0
  57. package/dist/spec/from-document.d.ts +21 -0
  58. package/dist/spec/from-document.js +18 -0
  59. package/dist/spec/types.d.ts +1 -0
  60. package/dist/spec/types.js +1 -0
  61. package/dist/triggers/publish-trigger.d.ts +81 -0
  62. package/dist/triggers/publish-trigger.js +137 -0
  63. package/dist/triggers/spec-change.d.ts +85 -0
  64. package/dist/triggers/spec-change.js +224 -0
  65. package/package.json +54 -0
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # ph-clint-tpl-cli
2
+
3
+ Template for the **ph-clint CLI side** of an implementation project. Starts
4
+ as a flat layout (no Powerhouse reactor-package alongside it). When the
5
+ `powerhouse` feature gets toggled on, the generator performs a one-time
6
+ migration that moves this tree into `{name}-cli/` and scaffolds a sibling
7
+ `{name}-app/`.
8
+
9
+ ## Folder layout
10
+
11
+ ```
12
+ cli/
13
+ ├── src/
14
+ │ ├── main.ts # bin entrypoint (cli.run(process.argv))
15
+ │ ├── cli.ts # defineCli(...) call with @clint markers
16
+ │ ├── config.ts # configSchema + secretsSchema
17
+ │ ├── mastra/ # Mastra Studio entry (populated when Mastra is on)
18
+ │ ├── agents/ # Mastra agent definitions
19
+ │ ├── commands/ # defineCommand(...) definitions
20
+ │ ├── services/ # defineService(...) definitions
21
+ │ └── triggers/ # defineTrigger(...) definitions
22
+ ├── prompts/ # Handlebars source for agent profiles & skills
23
+ │ ├── agent-profiles/ # AgentBase.md + specialized profiles
24
+ │ ├── skills-tpl/ # skill templates (authored here)
25
+ │ └── skills-ext/ # external/pre-built skills (dropped in as-is)
26
+ ├── scripts/
27
+ │ └── build-skills.ts # compiles prompts/ → gen/ via ph-clint-dev
28
+ ├── gen/ # codegen output (gitignored; built at build:skills)
29
+ └── tests/ # user-authored tests
30
+ ```
31
+
32
+ ## Feature toggles
33
+
34
+ Three independently togglable features. Each one is a `@clint:begin {name}`
35
+ / `@clint:end {name}` region that `ts-morph` can rewrite:
36
+
37
+ ### `powerhouse`
38
+
39
+ Enables the Powerhouse Reactor stack (Reactor, optional Switchboard,
40
+ optional Connect). On first enablement, the generator performs a one-time
41
+ migration:
42
+
43
+ 1. Moves every file from `{root}/` to `{root}/{name}-cli/`.
44
+ 2. Runs `ph init` inside `{root}/{name}-app/` to scaffold the standard
45
+ Powerhouse reactor-package layout.
46
+ 3. Writes a new root `package.json` with passthrough scripts (no pnpm
47
+ workspaces — they interfere with `{name}-app`'s own builds).
48
+
49
+ ### `mastra`
50
+
51
+ Enables the Mastra AI agent stack — agent definitions, thread-based memory
52
+ (LibSQL), optional MCP client, and the Mastra Studio entry point at
53
+ `src/mastra/index.ts` so `mastra dev` / `mastra build` / `mastra start` work.
54
+
55
+ ### `routine`
56
+
57
+ Enables the tick-based routine loop and trigger registration. Forced on
58
+ when `mastra` is enabled (an agent without a routine can still run from the
59
+ REPL, but most useful setups want the loop).
60
+
61
+ ## Codegen markers
62
+
63
+ Regions the generator can rewrite look like:
64
+
65
+ ```ts
66
+ // src/cli.ts
67
+ export const cli = defineCli({
68
+ // @clint:begin commands
69
+ commands: [/* list injected by codegen */],
70
+ // @clint:end commands
71
+
72
+ // @clint:begin services
73
+ services: [/* list injected by codegen */],
74
+ // @clint:end services
75
+ });
76
+ ```
77
+
78
+ Everything *outside* the markers is user-editable and preserved across
79
+ regenerations. Everything *inside* a `@clint:begin`/`@clint:end` pair is
80
+ codegen-owned.
81
+
82
+ Files under `gen/` are fully codegen-owned — wiped and rewritten on every
83
+ `build:skills`. Everything in `src/` is human-owned except for the
84
+ explicitly marked regions.
@@ -0,0 +1,12 @@
1
+ import type { AgentProvider, AgentSetupContext } from '@powerhousedao/ph-clint';
2
+ import type { Config } from '../framework.js';
3
+ export declare const AGENT_ID = "clint";
4
+ /**
5
+ * Agent factory for the ph-clint CLI.
6
+ *
7
+ * Demo mode echoes prompts; with an API key set via PH_CLINT_API_KEY, builds
8
+ * a full Mastra agent. The Powerhouse integration is still in scope but the
9
+ * agent does not yet write to any document model (document models land in
10
+ * Phase 4).
11
+ */
12
+ export declare function createAgent(ctx: AgentSetupContext<Config>): Promise<AgentProvider>;
@@ -0,0 +1,42 @@
1
+ export const AGENT_ID = 'clint';
2
+ const instructions = `You are Clint — a ph-clint assistant that helps users scaffold, configure, and maintain ph-clint implementation projects.
3
+
4
+ ## Behavior
5
+ - Be concise and practical.
6
+ - When the user asks about a project, inspect the ClintProjectSpecification document via the Powerhouse Reactor when available.
7
+ - Prefer small, incremental changes to the project's spec document over direct file edits.`;
8
+ /**
9
+ * Agent factory for the ph-clint CLI.
10
+ *
11
+ * Demo mode echoes prompts; with an API key set via PH_CLINT_API_KEY, builds
12
+ * a full Mastra agent. The Powerhouse integration is still in scope but the
13
+ * agent does not yet write to any document model (document models land in
14
+ * Phase 4).
15
+ */
16
+ export async function createAgent(ctx) {
17
+ if (!ctx.config.apiKey)
18
+ return createDemoAgent();
19
+ const { createMastraHelpers } = await import('@powerhousedao/ph-clint/mastra');
20
+ const { Agent } = await import('@mastra/core/agent');
21
+ const m = createMastraHelpers(ctx);
22
+ const mastraAgent = new Agent({
23
+ id: AGENT_ID,
24
+ name: 'Clint',
25
+ instructions,
26
+ model: { id: ctx.config.model, apiKey: ctx.config.apiKey },
27
+ tools: await m.getTools(),
28
+ memory: await m.createMemory(),
29
+ });
30
+ return m.wrapAgent(mastraAgent, { maxSteps: 40 });
31
+ }
32
+ function createDemoAgent() {
33
+ return {
34
+ id: AGENT_ID,
35
+ async *stream(prompt) {
36
+ yield {
37
+ type: 'text-delta',
38
+ text: `[Clint demo mode — set PH_CLINT_API_KEY for real LLM responses]\n\nYou said: "${prompt}"\n`,
39
+ };
40
+ },
41
+ };
42
+ }
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const cli: import("@powerhousedao/ph-clint").Cli;
package/dist/cli.js ADDED
@@ -0,0 +1,122 @@
1
+ /**
2
+ * ph-clint CLI definition.
3
+ *
4
+ * This file is the codegen anchor point. Regions bracketed by
5
+ * `@clint:begin {name}` / `@clint:end {name}` comment markers are
6
+ * rewritten by ph-clint-cli's generator when the project spec changes.
7
+ * Everything outside the markers is user-editable and preserved.
8
+ */
9
+ import path from 'node:path';
10
+ import { defineCli, buildDefaultReactor, deterministicId } from '@powerhousedao/ph-clint';
11
+ import { z } from 'zod';
12
+ import { CLI_NAME, CLI_VERSION, CLI_ROOT } from './config.js';
13
+ import { configSchema, secretsSchema } from './framework.js';
14
+ // @clint:begin imports
15
+ import { documentModels } from '@powerhousedao/ph-clint-app';
16
+ import { createAgent } from './agents/clint-agent.js';
17
+ import { init } from './commands/clint-project-init.js';
18
+ import { regen } from './commands/clint-project-regen.js';
19
+ import { build } from './commands/clint-project-build.js';
20
+ import { clintProjectPublish } from './commands/clint-project-publish.js';
21
+ import { clintProject } from './services/clint-project.js';
22
+ import { skillsSync } from './commands/clint-skills-sync.js';
23
+ import { specChangeTrigger } from './triggers/spec-change.js';
24
+ import { publishTrigger } from './triggers/publish-trigger.js';
25
+ // @clint:end imports
26
+ export const cli = defineCli({
27
+ name: CLI_NAME,
28
+ version: CLI_VERSION,
29
+ root: CLI_ROOT,
30
+ description: `${CLI_NAME} v${CLI_VERSION} — scaffold and maintain ph-clint implementation projects`,
31
+ configSchema,
32
+ secretsSchema,
33
+ // @clint:begin commands
34
+ commands: [init, regen, build, clintProjectPublish, skillsSync],
35
+ // @clint:end commands
36
+ // @clint:begin services
37
+ services: [clintProject],
38
+ // @clint:end services
39
+ // @clint:begin triggers
40
+ triggers: [specChangeTrigger, publishTrigger],
41
+ routine: { id: 'triggers', name: 'Triggers' },
42
+ // @clint:end triggers
43
+ // @clint:begin prompts
44
+ prompts: {
45
+ artifacts: [path.join(CLI_ROOT, 'gen', 'skills'), path.join(CLI_ROOT, 'dist', 'gen', 'skills')],
46
+ agents: {
47
+ 'ph-clint-dev-agent': {
48
+ name: 'PhClintDevAgent',
49
+ sections: ['AgentBase.md'],
50
+ skills: ['cli-setup', 'command-definition', 'service-definition'],
51
+ },
52
+ },
53
+ skills: {
54
+ 'cli-setup': {
55
+ description: 'Set up a new CLI with defineCli, config schemas, entrypoint, and interactive mode',
56
+ inputSchema: z.object({
57
+ mode: z
58
+ .enum(['expert', 'discovery', 'one-shot'])
59
+ .default('expert')
60
+ .describe('Expert: align design decisions with the developer. Discovery: explain concepts step by step. One-shot: make all decisions autonomously'),
61
+ }),
62
+ instructionTemplate: 'Use your {{skillId}} skill in {{mode}} mode for: {{prompt}}',
63
+ },
64
+ 'command-definition': {
65
+ description: 'Define commands with Zod schemas, execute functions, return values, and parameter prompting',
66
+ inputSchema: z.object({
67
+ mode: z
68
+ .enum(['expert', 'discovery', 'one-shot'])
69
+ .default('expert')
70
+ .describe('Expert: align design decisions with the developer. Discovery: explain concepts step by step. One-shot: make all decisions autonomously'),
71
+ }),
72
+ instructionTemplate: 'Use your {{skillId}} skill in {{mode}} mode for: {{prompt}}',
73
+ },
74
+ 'service-definition': {
75
+ description: 'Define background services with readiness detection, preflight checks, and project scanning',
76
+ inputSchema: z.object({
77
+ mode: z
78
+ .enum(['expert', 'discovery', 'one-shot'])
79
+ .default('expert')
80
+ .describe('Expert: align design decisions with the developer. Discovery: explain concepts step by step. One-shot: make all decisions autonomously'),
81
+ }),
82
+ instructionTemplate: 'Use your {{skillId}} skill in {{mode}} mode for: {{prompt}}',
83
+ },
84
+ },
85
+ },
86
+ // @clint:end prompts
87
+ // @clint:begin events
88
+ events: {},
89
+ // @clint:end events
90
+ // @clint:begin interactive
91
+ interactive: {
92
+ welcome: ({ config, workdir }) => {
93
+ const mode = config.apiKey
94
+ ? config.model
95
+ : 'demo mode — set PH_CLINT_API_KEY for real LLM responses';
96
+ return [
97
+ `ph-clint v${CLI_VERSION}`,
98
+ `Model: ${mode}`,
99
+ `Workdir: ${workdir}`,
100
+ '',
101
+ 'Type a message to talk to the agent, or /help for commands.',
102
+ ].join('\n');
103
+ },
104
+ },
105
+ // @clint:end interactive
106
+ });
107
+ // @clint:begin reactor
108
+ cli.configureReactor({
109
+ create: (ctx) => buildDefaultReactor(ctx, {
110
+ documentModels: [...documentModels],
111
+ drives: [
112
+ { name: 'Clint Folders', role: 'personal', id: deterministicId(CLI_NAME, 'personal-drive') },
113
+ ],
114
+ subscriptions: { documentTypes: ['powerhouse/ph-clint-project'] },
115
+ }),
116
+ switchboard: { enabled: true },
117
+ connect: { enabled: true },
118
+ });
119
+ // @clint:end reactor
120
+ // @clint:begin mastra
121
+ cli.configureAgent(createAgent);
122
+ // @clint:end mastra
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Re-exports from @powerhousedao/ph-clint-dev/codegen with CLI_VERSION default.
3
+ */
4
+ import { type GenerateProjectOptions as DevGenerateProjectOptions, type GenerateProjectResult, type GenerateMode, type GeneratedFile } from '@powerhousedao/ph-clint-dev/codegen';
5
+ import type { CodegenContext } from '@powerhousedao/ph-clint-dev/codegen/types';
6
+ export type { GenerateProjectResult, GenerateMode, GeneratedFile, CodegenContext };
7
+ export interface GenerateProjectOptions extends Omit<DevGenerateProjectOptions, 'context'> {
8
+ /** Codegen context; defaults to CLI_VERSION when omitted. */
9
+ context?: CodegenContext;
10
+ }
11
+ export declare function generateProject(options: GenerateProjectOptions): Promise<GenerateProjectResult>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Re-exports from @powerhousedao/ph-clint-dev/codegen with CLI_VERSION default.
3
+ */
4
+ import { generateProject as _generateProject, } from '@powerhousedao/ph-clint-dev/codegen';
5
+ import { CLI_VERSION } from '../config.js';
6
+ export async function generateProject(options) {
7
+ return _generateProject({
8
+ ...options,
9
+ context: options.context ?? { toolVersion: CLI_VERSION },
10
+ });
11
+ }
@@ -0,0 +1,83 @@
1
+ import { z } from 'zod';
2
+ export declare const build: import("@powerhousedao/ph-clint").Command<z.ZodObject<{
3
+ dir: z.ZodOptional<z.ZodString>;
4
+ verbose: z.ZodDefault<z.ZodBoolean>;
5
+ }, z.core.$strip>, {
6
+ text: string;
7
+ }, {
8
+ model: string;
9
+ devServicePort: number;
10
+ phVersion: string;
11
+ apiKey?: string | undefined;
12
+ }, import("@powerhousedao/ph-clint").InferRegistry<readonly [{
13
+ readonly version: 1;
14
+ readonly reducer: import("document-model").Reducer<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
15
+ readonly actions: {
16
+ setAgentModel: (input: import("@powerhousedao/ph-clint-app").SetAgentModelInput) => import("@powerhousedao/ph-clint-app").SetAgentModelAction;
17
+ addAgentProfileRef: (input: import("@powerhousedao/ph-clint-app").AddAgentProfileRefInput) => import("@powerhousedao/ph-clint-app").AddAgentProfileRefAction;
18
+ removeAgentProfileRef: (input: import("@powerhousedao/ph-clint-app").RemoveAgentProfileRefInput) => import("@powerhousedao/ph-clint-app").RemoveAgentProfileRefAction;
19
+ reorderAgentProfileRefs: (input: import("@powerhousedao/ph-clint-app").ReorderAgentProfileRefsInput) => import("@powerhousedao/ph-clint-app").ReorderAgentProfileRefsAction;
20
+ addAgentSkill: (input: import("@powerhousedao/ph-clint-app").AddAgentSkillInput) => import("@powerhousedao/ph-clint-app").AddAgentSkillAction;
21
+ removeAgentSkill: (input: import("@powerhousedao/ph-clint-app").RemoveAgentSkillInput) => import("@powerhousedao/ph-clint-app").RemoveAgentSkillAction;
22
+ addAgentToolPattern: (input: import("@powerhousedao/ph-clint-app").AddAgentToolPatternInput) => import("@powerhousedao/ph-clint-app").AddAgentToolPatternAction;
23
+ removeAgentToolPattern: (input: import("@powerhousedao/ph-clint-app").RemoveAgentToolPatternInput) => import("@powerhousedao/ph-clint-app").RemoveAgentToolPatternAction;
24
+ addSubAgent: (input: import("@powerhousedao/ph-clint-app").AddSubAgentInput) => import("@powerhousedao/ph-clint-app").AddSubAgentAction;
25
+ removeSubAgent: (input: import("@powerhousedao/ph-clint-app").RemoveSubAgentInput) => import("@powerhousedao/ph-clint-app").RemoveSubAgentAction;
26
+ setSubAgentName: (input: import("@powerhousedao/ph-clint-app").SetSubAgentNameInput) => import("@powerhousedao/ph-clint-app").SetSubAgentNameAction;
27
+ setSubAgentDescription: (input: import("@powerhousedao/ph-clint-app").SetSubAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").SetSubAgentDescriptionAction;
28
+ setMainAgentName: (input: import("@powerhousedao/ph-clint-app").SetMainAgentNameInput) => import("@powerhousedao/ph-clint-app").SetMainAgentNameAction;
29
+ setMainAgentDescription: (input: import("@powerhousedao/ph-clint-app").SetMainAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").SetMainAgentDescriptionAction;
30
+ clearMainAgentDescription: (input: import("@powerhousedao/ph-clint-app").ClearMainAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").ClearMainAgentDescriptionAction;
31
+ setMainAgentImage: (input: import("@powerhousedao/ph-clint-app").SetMainAgentImageInput) => import("@powerhousedao/ph-clint-app").SetMainAgentImageAction;
32
+ clearMainAgentImage: (input: import("@powerhousedao/ph-clint-app").ClearMainAgentImageInput) => import("@powerhousedao/ph-clint-app").ClearMainAgentImageAction;
33
+ addProfile: (input: import("@powerhousedao/ph-clint-app").AddProfileInput) => import("@powerhousedao/ph-clint-app").AddProfileAction;
34
+ updateProfile: (input: import("@powerhousedao/ph-clint-app").UpdateProfileInput) => import("@powerhousedao/ph-clint-app").UpdateProfileAction;
35
+ removeProfile: (input: import("@powerhousedao/ph-clint-app").RemoveProfileInput) => import("@powerhousedao/ph-clint-app").RemoveProfileAction;
36
+ reorderProfiles: (input: import("@powerhousedao/ph-clint-app").ReorderProfilesInput) => import("@powerhousedao/ph-clint-app").ReorderProfilesAction;
37
+ addModel: (input: import("@powerhousedao/ph-clint-app").AddModelInput) => import("@powerhousedao/ph-clint-app").AddModelAction;
38
+ removeModel: (input: import("@powerhousedao/ph-clint-app").RemoveModelInput) => import("@powerhousedao/ph-clint-app").RemoveModelAction;
39
+ enableMastra: (input: import("@powerhousedao/ph-clint-app").EnableMastraInput) => import("@powerhousedao/ph-clint-app").EnableMastraAction;
40
+ disableMastra: (input: import("@powerhousedao/ph-clint-app").DisableMastraInput) => import("@powerhousedao/ph-clint-app").DisableMastraAction;
41
+ setEnableChat: (input: import("@powerhousedao/ph-clint-app").SetEnableChatInput) => import("@powerhousedao/ph-clint-app").SetEnableChatAction;
42
+ addSupportedResource: (input: import("@powerhousedao/ph-clint-app").AddSupportedResourceInput) => import("@powerhousedao/ph-clint-app").AddSupportedResourceAction;
43
+ removeSupportedResource: (input: import("@powerhousedao/ph-clint-app").RemoveSupportedResourceInput) => import("@powerhousedao/ph-clint-app").RemoveSupportedResourceAction;
44
+ setProxyEnabled: (input: import("@powerhousedao/ph-clint-app").SetProxyEnabledInput) => import("@powerhousedao/ph-clint-app").SetProxyEnabledAction;
45
+ setObservabilityEnabled: (input: import("@powerhousedao/ph-clint-app").SetObservabilityEnabledInput) => import("@powerhousedao/ph-clint-app").SetObservabilityEnabledAction;
46
+ importSpec: (input: import("@powerhousedao/ph-clint-app").ImportSpecInput) => import("@powerhousedao/ph-clint-app").ImportSpecAction;
47
+ bumpVersion: (input: import("@powerhousedao/ph-clint-app").BumpVersionInput) => import("@powerhousedao/ph-clint-app").BumpVersionAction;
48
+ publishDev: (input: import("@powerhousedao/ph-clint-app").PublishDevInput) => import("@powerhousedao/ph-clint-app").PublishDevAction;
49
+ publishStaging: (input: import("@powerhousedao/ph-clint-app").PublishStagingInput) => import("@powerhousedao/ph-clint-app").PublishStagingAction;
50
+ publishProduction: (input: import("@powerhousedao/ph-clint-app").PublishProductionInput) => import("@powerhousedao/ph-clint-app").PublishProductionAction;
51
+ setPublishStatus: (input: import("@powerhousedao/ph-clint-app").SetPublishStatusInput) => import("@powerhousedao/ph-clint-app").SetPublishStatusAction;
52
+ addExternalSkill: (input: import("@powerhousedao/ph-clint-app").AddExternalSkillInput) => import("@powerhousedao/ph-clint-app").AddExternalSkillAction;
53
+ removeExternalSkill: (input: import("@powerhousedao/ph-clint-app").RemoveExternalSkillInput) => import("@powerhousedao/ph-clint-app").RemoveExternalSkillAction;
54
+ setExternalSkillName: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillNameInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillNameAction;
55
+ setExternalSkillGithubUrl: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlAction;
56
+ addPowerhousePackage: (input: import("@powerhousedao/ph-clint-app").AddPowerhousePackageInput) => import("@powerhousedao/ph-clint-app").AddPowerhousePackageAction;
57
+ removePowerhousePackage: (input: import("@powerhousedao/ph-clint-app").RemovePowerhousePackageInput) => import("@powerhousedao/ph-clint-app").RemovePowerhousePackageAction;
58
+ addPackageDocumentType: (input: import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeAction;
59
+ removePackageDocumentType: (input: import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeAction;
60
+ setPackageVersion: (input: import("@powerhousedao/ph-clint-app").SetPackageVersionInput) => import("@powerhousedao/ph-clint-app").SetPackageVersionAction;
61
+ enableRoutine: (input: import("@powerhousedao/ph-clint-app").EnableRoutineInput) => import("@powerhousedao/ph-clint-app").EnableRoutineAction;
62
+ disableRoutine: (input: import("@powerhousedao/ph-clint-app").DisableRoutineInput) => import("@powerhousedao/ph-clint-app").DisableRoutineAction;
63
+ setPowerhouseLevel: (input: import("@powerhousedao/ph-clint-app").SetPowerhouseLevelInput) => import("@powerhousedao/ph-clint-app").SetPowerhouseLevelAction;
64
+ setDescription: (input: import("@powerhousedao/ph-clint-app").SetDescriptionInput) => import("@powerhousedao/ph-clint-app").SetDescriptionAction;
65
+ setVersion: (input: import("@powerhousedao/ph-clint-app").SetVersionInput) => import("@powerhousedao/ph-clint-app").SetVersionAction;
66
+ setPackageIdentifier: (input: import("@powerhousedao/ph-clint-app").SetPackageIdentifierInput) => import("@powerhousedao/ph-clint-app").SetPackageIdentifierAction;
67
+ setName: (name: string | {
68
+ name: string;
69
+ }) => import("document-model").SetNameAction;
70
+ setPreferredEditor: (input: string | null | {
71
+ preferredEditor: string | null;
72
+ }) => import("document-model").SetPreferredEditorAction;
73
+ undo: (count?: number, scope?: string) => import("document-model").UndoAction;
74
+ redo: (count?: number, scope?: string) => import("document-model").RedoAction;
75
+ prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
76
+ loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
77
+ name: string;
78
+ }, operations: number) => import("document-model").LoadStateAction;
79
+ noop: (scope?: string) => import("document-model").NOOPAction;
80
+ };
81
+ readonly utils: import("document-model").DocumentModelUtils<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
82
+ readonly documentModel: import("document-model").DocumentModelPHState;
83
+ }]>>;
@@ -0,0 +1,34 @@
1
+ import path from 'node:path';
2
+ import { defineCommand } from '../framework.js';
3
+ import { z } from 'zod';
4
+ import { detectLayout } from '@powerhousedao/ph-clint-dev';
5
+ const inputSchema = z.object({
6
+ dir: z.string().optional().describe('Project root directory (default: cwd)'),
7
+ verbose: z.boolean().default(false),
8
+ });
9
+ export const build = defineCommand({
10
+ id: 'clint-project-build',
11
+ description: 'Build all packages in the project',
12
+ inputSchema,
13
+ execute: async (input, { workdir, stdout, runProcess }) => {
14
+ const dir = path.resolve(input.dir ?? workdir);
15
+ const layout = detectLayout(dir);
16
+ if (layout?.type === 'split') {
17
+ stdout(`Building app package (${layout.app})...\n`);
18
+ const appResult = await runProcess('pnpm build', { cwd: layout.app, timeout: 120_000 });
19
+ if (!appResult.success)
20
+ return { text: `App build failed.` };
21
+ stdout(`Building cli package (${layout.cli})...\n`);
22
+ const cliResult = await runProcess('pnpm build', { cwd: layout.cli, timeout: 120_000 });
23
+ if (!cliResult.success)
24
+ return { text: `CLI build failed.` };
25
+ }
26
+ else {
27
+ stdout(`Building project...\n`);
28
+ const result = await runProcess('pnpm build', { cwd: layout?.cli ?? dir, timeout: 120_000 });
29
+ if (!result.success)
30
+ return { text: `Build failed.` };
31
+ }
32
+ return { text: 'Build complete.' };
33
+ },
34
+ });
@@ -0,0 +1,177 @@
1
+ import { z } from 'zod';
2
+ import { type ClintProjectSpec } from '../spec/types.js';
3
+ declare const inputSchema: z.ZodObject<{
4
+ dir: z.ZodOptional<z.ZodString>;
5
+ name: z.ZodString;
6
+ description: z.ZodOptional<z.ZodString>;
7
+ enablePowerhouse: z.ZodDefault<z.ZodBoolean>;
8
+ enableMastra: z.ZodDefault<z.ZodBoolean>;
9
+ enableRoutine: z.ZodDefault<z.ZodBoolean>;
10
+ enableObservability: z.ZodDefault<z.ZodBoolean>;
11
+ force: z.ZodDefault<z.ZodBoolean>;
12
+ skipInstall: z.ZodDefault<z.ZodBoolean>;
13
+ }, z.core.$strip>;
14
+ type InitInput = z.output<typeof inputSchema>;
15
+ export declare function buildSpec(input: InitInput): ClintProjectSpec;
16
+ export declare const init: import("@powerhousedao/ph-clint").Command<z.ZodObject<{
17
+ dir: z.ZodOptional<z.ZodString>;
18
+ name: z.ZodString;
19
+ description: z.ZodOptional<z.ZodString>;
20
+ enablePowerhouse: z.ZodDefault<z.ZodBoolean>;
21
+ enableMastra: z.ZodDefault<z.ZodBoolean>;
22
+ enableRoutine: z.ZodDefault<z.ZodBoolean>;
23
+ enableObservability: z.ZodDefault<z.ZodBoolean>;
24
+ force: z.ZodDefault<z.ZodBoolean>;
25
+ skipInstall: z.ZodDefault<z.ZodBoolean>;
26
+ }, z.core.$strip>, {
27
+ text: string;
28
+ data?: undefined;
29
+ } | {
30
+ text: string;
31
+ data: {
32
+ targetDir: string;
33
+ spec: {
34
+ name: string;
35
+ version: string;
36
+ description: string;
37
+ features: {
38
+ powerhouse: "Disabled" | "Reactor" | "Switchboard" | "Connect";
39
+ mastra: {
40
+ enabled: boolean;
41
+ mainAgent: {
42
+ description: string | null;
43
+ image: string | null;
44
+ id: string;
45
+ name: string;
46
+ modelId: string;
47
+ profileIds: string[];
48
+ skills: string[];
49
+ toolPatterns: string[];
50
+ } | null;
51
+ subAgents: {
52
+ description: string;
53
+ id: string;
54
+ name: string;
55
+ modelId: string;
56
+ profileIds: string[];
57
+ skills: string[];
58
+ toolPatterns: string[];
59
+ }[];
60
+ models: {
61
+ id: string;
62
+ }[];
63
+ profiles: {
64
+ id: string;
65
+ title: string;
66
+ content: string;
67
+ }[];
68
+ common: {
69
+ enableChat: boolean;
70
+ };
71
+ };
72
+ routine: {
73
+ enabled: boolean;
74
+ };
75
+ };
76
+ packages: {
77
+ id: string;
78
+ packageName: string;
79
+ documentTypes: string[];
80
+ version: string | null;
81
+ }[];
82
+ externalSkills: {
83
+ id: string;
84
+ name: string;
85
+ githubUrl: string;
86
+ }[];
87
+ deployment: {
88
+ proxyEnabled: boolean;
89
+ observabilityEnabled: boolean;
90
+ supportedResources: string[];
91
+ dockerfile?: string | undefined;
92
+ dockerTarget?: string | undefined;
93
+ };
94
+ scope?: string | undefined;
95
+ documentId?: string | undefined;
96
+ documentType?: string | undefined;
97
+ };
98
+ fileCount: number;
99
+ };
100
+ }, {
101
+ model: string;
102
+ devServicePort: number;
103
+ phVersion: string;
104
+ apiKey?: string | undefined;
105
+ }, import("@powerhousedao/ph-clint").InferRegistry<readonly [{
106
+ readonly version: 1;
107
+ readonly reducer: import("document-model").Reducer<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
108
+ readonly actions: {
109
+ setAgentModel: (input: import("@powerhousedao/ph-clint-app").SetAgentModelInput) => import("@powerhousedao/ph-clint-app").SetAgentModelAction;
110
+ addAgentProfileRef: (input: import("@powerhousedao/ph-clint-app").AddAgentProfileRefInput) => import("@powerhousedao/ph-clint-app").AddAgentProfileRefAction;
111
+ removeAgentProfileRef: (input: import("@powerhousedao/ph-clint-app").RemoveAgentProfileRefInput) => import("@powerhousedao/ph-clint-app").RemoveAgentProfileRefAction;
112
+ reorderAgentProfileRefs: (input: import("@powerhousedao/ph-clint-app").ReorderAgentProfileRefsInput) => import("@powerhousedao/ph-clint-app").ReorderAgentProfileRefsAction;
113
+ addAgentSkill: (input: import("@powerhousedao/ph-clint-app").AddAgentSkillInput) => import("@powerhousedao/ph-clint-app").AddAgentSkillAction;
114
+ removeAgentSkill: (input: import("@powerhousedao/ph-clint-app").RemoveAgentSkillInput) => import("@powerhousedao/ph-clint-app").RemoveAgentSkillAction;
115
+ addAgentToolPattern: (input: import("@powerhousedao/ph-clint-app").AddAgentToolPatternInput) => import("@powerhousedao/ph-clint-app").AddAgentToolPatternAction;
116
+ removeAgentToolPattern: (input: import("@powerhousedao/ph-clint-app").RemoveAgentToolPatternInput) => import("@powerhousedao/ph-clint-app").RemoveAgentToolPatternAction;
117
+ addSubAgent: (input: import("@powerhousedao/ph-clint-app").AddSubAgentInput) => import("@powerhousedao/ph-clint-app").AddSubAgentAction;
118
+ removeSubAgent: (input: import("@powerhousedao/ph-clint-app").RemoveSubAgentInput) => import("@powerhousedao/ph-clint-app").RemoveSubAgentAction;
119
+ setSubAgentName: (input: import("@powerhousedao/ph-clint-app").SetSubAgentNameInput) => import("@powerhousedao/ph-clint-app").SetSubAgentNameAction;
120
+ setSubAgentDescription: (input: import("@powerhousedao/ph-clint-app").SetSubAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").SetSubAgentDescriptionAction;
121
+ setMainAgentName: (input: import("@powerhousedao/ph-clint-app").SetMainAgentNameInput) => import("@powerhousedao/ph-clint-app").SetMainAgentNameAction;
122
+ setMainAgentDescription: (input: import("@powerhousedao/ph-clint-app").SetMainAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").SetMainAgentDescriptionAction;
123
+ clearMainAgentDescription: (input: import("@powerhousedao/ph-clint-app").ClearMainAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").ClearMainAgentDescriptionAction;
124
+ setMainAgentImage: (input: import("@powerhousedao/ph-clint-app").SetMainAgentImageInput) => import("@powerhousedao/ph-clint-app").SetMainAgentImageAction;
125
+ clearMainAgentImage: (input: import("@powerhousedao/ph-clint-app").ClearMainAgentImageInput) => import("@powerhousedao/ph-clint-app").ClearMainAgentImageAction;
126
+ addProfile: (input: import("@powerhousedao/ph-clint-app").AddProfileInput) => import("@powerhousedao/ph-clint-app").AddProfileAction;
127
+ updateProfile: (input: import("@powerhousedao/ph-clint-app").UpdateProfileInput) => import("@powerhousedao/ph-clint-app").UpdateProfileAction;
128
+ removeProfile: (input: import("@powerhousedao/ph-clint-app").RemoveProfileInput) => import("@powerhousedao/ph-clint-app").RemoveProfileAction;
129
+ reorderProfiles: (input: import("@powerhousedao/ph-clint-app").ReorderProfilesInput) => import("@powerhousedao/ph-clint-app").ReorderProfilesAction;
130
+ addModel: (input: import("@powerhousedao/ph-clint-app").AddModelInput) => import("@powerhousedao/ph-clint-app").AddModelAction;
131
+ removeModel: (input: import("@powerhousedao/ph-clint-app").RemoveModelInput) => import("@powerhousedao/ph-clint-app").RemoveModelAction;
132
+ enableMastra: (input: import("@powerhousedao/ph-clint-app").EnableMastraInput) => import("@powerhousedao/ph-clint-app").EnableMastraAction;
133
+ disableMastra: (input: import("@powerhousedao/ph-clint-app").DisableMastraInput) => import("@powerhousedao/ph-clint-app").DisableMastraAction;
134
+ setEnableChat: (input: import("@powerhousedao/ph-clint-app").SetEnableChatInput) => import("@powerhousedao/ph-clint-app").SetEnableChatAction;
135
+ addSupportedResource: (input: import("@powerhousedao/ph-clint-app").AddSupportedResourceInput) => import("@powerhousedao/ph-clint-app").AddSupportedResourceAction;
136
+ removeSupportedResource: (input: import("@powerhousedao/ph-clint-app").RemoveSupportedResourceInput) => import("@powerhousedao/ph-clint-app").RemoveSupportedResourceAction;
137
+ setProxyEnabled: (input: import("@powerhousedao/ph-clint-app").SetProxyEnabledInput) => import("@powerhousedao/ph-clint-app").SetProxyEnabledAction;
138
+ setObservabilityEnabled: (input: import("@powerhousedao/ph-clint-app").SetObservabilityEnabledInput) => import("@powerhousedao/ph-clint-app").SetObservabilityEnabledAction;
139
+ importSpec: (input: import("@powerhousedao/ph-clint-app").ImportSpecInput) => import("@powerhousedao/ph-clint-app").ImportSpecAction;
140
+ bumpVersion: (input: import("@powerhousedao/ph-clint-app").BumpVersionInput) => import("@powerhousedao/ph-clint-app").BumpVersionAction;
141
+ publishDev: (input: import("@powerhousedao/ph-clint-app").PublishDevInput) => import("@powerhousedao/ph-clint-app").PublishDevAction;
142
+ publishStaging: (input: import("@powerhousedao/ph-clint-app").PublishStagingInput) => import("@powerhousedao/ph-clint-app").PublishStagingAction;
143
+ publishProduction: (input: import("@powerhousedao/ph-clint-app").PublishProductionInput) => import("@powerhousedao/ph-clint-app").PublishProductionAction;
144
+ setPublishStatus: (input: import("@powerhousedao/ph-clint-app").SetPublishStatusInput) => import("@powerhousedao/ph-clint-app").SetPublishStatusAction;
145
+ addExternalSkill: (input: import("@powerhousedao/ph-clint-app").AddExternalSkillInput) => import("@powerhousedao/ph-clint-app").AddExternalSkillAction;
146
+ removeExternalSkill: (input: import("@powerhousedao/ph-clint-app").RemoveExternalSkillInput) => import("@powerhousedao/ph-clint-app").RemoveExternalSkillAction;
147
+ setExternalSkillName: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillNameInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillNameAction;
148
+ setExternalSkillGithubUrl: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlAction;
149
+ addPowerhousePackage: (input: import("@powerhousedao/ph-clint-app").AddPowerhousePackageInput) => import("@powerhousedao/ph-clint-app").AddPowerhousePackageAction;
150
+ removePowerhousePackage: (input: import("@powerhousedao/ph-clint-app").RemovePowerhousePackageInput) => import("@powerhousedao/ph-clint-app").RemovePowerhousePackageAction;
151
+ addPackageDocumentType: (input: import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeAction;
152
+ removePackageDocumentType: (input: import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeAction;
153
+ setPackageVersion: (input: import("@powerhousedao/ph-clint-app").SetPackageVersionInput) => import("@powerhousedao/ph-clint-app").SetPackageVersionAction;
154
+ enableRoutine: (input: import("@powerhousedao/ph-clint-app").EnableRoutineInput) => import("@powerhousedao/ph-clint-app").EnableRoutineAction;
155
+ disableRoutine: (input: import("@powerhousedao/ph-clint-app").DisableRoutineInput) => import("@powerhousedao/ph-clint-app").DisableRoutineAction;
156
+ setPowerhouseLevel: (input: import("@powerhousedao/ph-clint-app").SetPowerhouseLevelInput) => import("@powerhousedao/ph-clint-app").SetPowerhouseLevelAction;
157
+ setDescription: (input: import("@powerhousedao/ph-clint-app").SetDescriptionInput) => import("@powerhousedao/ph-clint-app").SetDescriptionAction;
158
+ setVersion: (input: import("@powerhousedao/ph-clint-app").SetVersionInput) => import("@powerhousedao/ph-clint-app").SetVersionAction;
159
+ setPackageIdentifier: (input: import("@powerhousedao/ph-clint-app").SetPackageIdentifierInput) => import("@powerhousedao/ph-clint-app").SetPackageIdentifierAction;
160
+ setName: (name: string | {
161
+ name: string;
162
+ }) => import("document-model").SetNameAction;
163
+ setPreferredEditor: (input: string | null | {
164
+ preferredEditor: string | null;
165
+ }) => import("document-model").SetPreferredEditorAction;
166
+ undo: (count?: number, scope?: string) => import("document-model").UndoAction;
167
+ redo: (count?: number, scope?: string) => import("document-model").RedoAction;
168
+ prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
169
+ loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
170
+ name: string;
171
+ }, operations: number) => import("document-model").LoadStateAction;
172
+ noop: (scope?: string) => import("document-model").NOOPAction;
173
+ };
174
+ readonly utils: import("document-model").DocumentModelUtils<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
175
+ readonly documentModel: import("document-model").DocumentModelPHState;
176
+ }]>>;
177
+ export {};