@powerhousedao/ph-clint-cli 0.1.0-dev.7 → 0.1.0-dev.71

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 (101) hide show
  1. package/dist/cli.js +52 -10
  2. package/dist/codegen/actions.d.ts +1 -0
  3. package/dist/codegen/actions.js +1 -0
  4. package/dist/codegen/builders/agent-ts.d.ts +4 -4
  5. package/dist/codegen/builders/agent-ts.js +92 -2
  6. package/dist/codegen/builders/app-index-ts.d.ts +3 -10
  7. package/dist/codegen/builders/app-index-ts.js +30 -20
  8. package/dist/codegen/builders/cli-package-json.d.ts +1 -8
  9. package/dist/codegen/builders/cli-package-json.js +1 -96
  10. package/dist/codegen/builders/cli-ts.js +88 -37
  11. package/dist/codegen/builders/config-ts.d.ts +1 -1
  12. package/dist/codegen/builders/config-ts.js +2 -8
  13. package/dist/codegen/builders/demo-agent-ts.d.ts +8 -0
  14. package/dist/codegen/builders/demo-agent-ts.js +50 -0
  15. package/dist/codegen/builders/eslint-config-js.d.ts +1 -1
  16. package/dist/codegen/builders/eslint-config-js.js +7 -4
  17. package/dist/codegen/builders/framework-gen-ts.d.ts +11 -6
  18. package/dist/codegen/builders/framework-gen-ts.js +73 -21
  19. package/dist/codegen/builders/framework-ts.js +33 -7
  20. package/dist/codegen/builders/index.d.ts +1 -44
  21. package/dist/codegen/builders/index.js +1 -61
  22. package/dist/codegen/builders/manifest-json.d.ts +6 -0
  23. package/dist/codegen/builders/manifest-json.js +31 -0
  24. package/dist/codegen/builders/mastra-index-ts.d.ts +3 -0
  25. package/dist/codegen/builders/mastra-index-ts.js +47 -5
  26. package/dist/codegen/builders/publish-config-js.d.ts +8 -0
  27. package/dist/codegen/builders/publish-config-js.js +33 -0
  28. package/dist/codegen/builders/publish-config-ts.d.ts +4 -2
  29. package/dist/codegen/builders/publish-config-ts.js +25 -11
  30. package/dist/codegen/builders/readme-md.js +7 -6
  31. package/dist/codegen/builders/root-package-json.js +14 -11
  32. package/dist/codegen/builders/smoke-test-ts.d.ts +2 -0
  33. package/dist/codegen/builders/smoke-test-ts.js +15 -0
  34. package/dist/codegen/exec.d.ts +1 -20
  35. package/dist/codegen/exec.js +1 -41
  36. package/dist/codegen/generated.d.ts +1 -0
  37. package/dist/codegen/generated.js +1 -0
  38. package/dist/codegen/hashes.d.ts +1 -6
  39. package/dist/codegen/hashes.js +1 -60
  40. package/dist/codegen/index.d.ts +8 -36
  41. package/dist/codegen/index.js +6 -293
  42. package/dist/codegen/markers.d.ts +1 -36
  43. package/dist/codegen/markers.js +1 -86
  44. package/dist/codegen/scaffold.d.ts +1 -34
  45. package/dist/codegen/scaffold.js +1 -60
  46. package/dist/codegen/write.d.ts +1 -6
  47. package/dist/codegen/write.js +1 -32
  48. package/dist/commands/clint-project-build.d.ts +63 -1
  49. package/dist/commands/clint-project-build.js +11 -28
  50. package/dist/commands/clint-project-init.d.ts +100 -10
  51. package/dist/commands/clint-project-init.js +63 -47
  52. package/dist/commands/clint-project-publish.d.ts +64 -1
  53. package/dist/commands/clint-project-publish.js +6 -4
  54. package/dist/commands/clint-project-regen.d.ts +63 -1
  55. package/dist/commands/clint-project-regen.js +26 -2
  56. package/dist/commands/clint-skills-sync.d.ts +72 -0
  57. package/dist/commands/clint-skills-sync.js +56 -0
  58. package/dist/framework.d.ts +228 -50
  59. package/dist/framework.gen.d.ts +34 -8
  60. package/dist/framework.js +1 -5
  61. package/{prompts/agent-profiles/AgentBase.md → dist/gen/agent-profiles/PhClintDevAgent.md} +1 -1
  62. package/dist/gen/skills/cli-setup/.cli-docs.md +135 -0
  63. package/dist/gen/skills/cli-setup/SKILL.md +125 -0
  64. package/dist/gen/skills/cli-setup/references/00.assess-cli-needs.md +53 -0
  65. package/dist/gen/skills/cli-setup/references/01.define-config-schema.md +78 -0
  66. package/dist/gen/skills/cli-setup/references/02.wire-cli.md +141 -0
  67. package/dist/gen/skills/cli-setup/references/03.add-entrypoint.md +128 -0
  68. package/dist/gen/skills/cli-setup/references/expected-outcome.md +3 -0
  69. package/dist/gen/skills/command-definition/.cli-docs.md +84 -0
  70. package/dist/gen/skills/command-definition/SKILL.md +99 -0
  71. package/dist/gen/skills/command-definition/references/00.assess-requirements.md +58 -0
  72. package/dist/gen/skills/command-definition/references/01.define-schema.md +72 -0
  73. package/dist/gen/skills/command-definition/references/02.implement-execute.md +118 -0
  74. package/dist/gen/skills/command-definition/references/03.add-prompting.md +54 -0
  75. package/dist/gen/skills/command-definition/references/expected-outcome.md +3 -0
  76. package/dist/gen/skills/service-definition/.cli-docs.md +214 -0
  77. package/dist/gen/skills/service-definition/SKILL.md +148 -0
  78. package/dist/gen/skills/service-definition/references/00.assess-service.md +69 -0
  79. package/dist/gen/skills/service-definition/references/01.define-service.md +166 -0
  80. package/dist/gen/skills/service-definition/references/02.add-preflight.md +132 -0
  81. package/dist/gen/skills/service-definition/references/03.add-project-scanner.md +82 -0
  82. package/dist/gen/skills/service-definition/references/04.wire-events.md +120 -0
  83. package/dist/gen/skills/service-definition/references/expected-outcome.md +3 -0
  84. package/dist/services/clint-project.js +21 -0
  85. package/dist/skills/sync.d.ts +1 -0
  86. package/dist/skills/sync.js +1 -0
  87. package/dist/spec/ensure-document.d.ts +17 -0
  88. package/dist/spec/ensure-document.js +56 -0
  89. package/dist/spec/file.d.ts +1 -4
  90. package/dist/spec/file.js +1 -34
  91. package/dist/spec/from-document.d.ts +4 -1
  92. package/dist/spec/from-document.js +4 -16
  93. package/dist/spec/types.d.ts +1 -62
  94. package/dist/spec/types.js +1 -112
  95. package/dist/triggers/publish-trigger.d.ts +67 -0
  96. package/dist/triggers/publish-trigger.js +137 -0
  97. package/dist/triggers/spec-change.d.ts +46 -18
  98. package/dist/triggers/spec-change.js +138 -102
  99. package/package.json +12 -17
  100. package/prompts/skills-ext/.gitkeep +0 -0
  101. package/prompts/skills-tpl/.gitkeep +0 -0
@@ -1,36 +1 @@
1
- /**
2
- * Marker-region parsing for `@clint:begin {name}` / `@clint:end {name}`
3
- * comment blocks. Used in delta mode to splice freshly-generated regions
4
- * into an existing, user-edited file while preserving everything outside
5
- * the markers.
6
- *
7
- * The only syntactic requirement is that the markers are on their own lines,
8
- * as ordinary line comments (`//`). Indentation is preserved for output.
9
- */
10
- export interface MarkerRegion {
11
- /** Region identifier (the text after `@clint:begin`). */
12
- name: string;
13
- /** Lines *between* the begin and end markers (exclusive). */
14
- body: string[];
15
- /** Indentation of the begin line — used when rewriting. */
16
- indent: string;
17
- /** Line index of the begin marker in the source. */
18
- beginLine: number;
19
- /** Line index of the end marker in the source. */
20
- endLine: number;
21
- }
22
- /**
23
- * Parse every `@clint:begin {name}` … `@clint:end {name}` block in `source`.
24
- * Throws if markers are mismatched or unclosed.
25
- */
26
- export declare function parseMarkerRegions(source: string): MarkerRegion[];
27
- /**
28
- * Replace every region in `target` that also exists in `source` with the
29
- * `source` region's body. Leaves regions present in `target` but not `source`
30
- * untouched. Ignores regions in `source` missing from `target`.
31
- *
32
- * Returns the rewritten file content.
33
- */
34
- export declare function spliceMarkerRegions(target: string, source: string): string;
35
- /** Convenience — true if `content` contains at least one `@clint:begin`. */
36
- export declare function hasMarkers(content: string): boolean;
1
+ export { type MarkerRegion, parseMarkerRegions, spliceMarkerRegions, hasMarkers, } from '@powerhousedao/ph-clint-dev/codegen/markers';
@@ -1,86 +1 @@
1
- /**
2
- * Marker-region parsing for `@clint:begin {name}` / `@clint:end {name}`
3
- * comment blocks. Used in delta mode to splice freshly-generated regions
4
- * into an existing, user-edited file while preserving everything outside
5
- * the markers.
6
- *
7
- * The only syntactic requirement is that the markers are on their own lines,
8
- * as ordinary line comments (`//`). Indentation is preserved for output.
9
- */
10
- const BEGIN_RE = /^([ \t]*)\/\/\s*@clint:begin\s+(\S+)\s*$/;
11
- const END_RE = /^([ \t]*)\/\/\s*@clint:end\s+(\S+)\s*$/;
12
- /**
13
- * Parse every `@clint:begin {name}` … `@clint:end {name}` block in `source`.
14
- * Throws if markers are mismatched or unclosed.
15
- */
16
- export function parseMarkerRegions(source) {
17
- const lines = source.split('\n');
18
- const regions = [];
19
- let open = null;
20
- let bodyStart = 0;
21
- for (let i = 0; i < lines.length; i++) {
22
- const line = lines[i];
23
- const begin = BEGIN_RE.exec(line);
24
- if (begin) {
25
- if (open) {
26
- throw new Error(`nested @clint:begin ${begin[2]} at line ${i + 1} while ${open.name} is still open`);
27
- }
28
- open = { name: begin[2], indent: begin[1], beginLine: i };
29
- bodyStart = i + 1;
30
- continue;
31
- }
32
- const end = END_RE.exec(line);
33
- if (end) {
34
- if (!open) {
35
- throw new Error(`@clint:end ${end[2]} at line ${i + 1} without matching begin`);
36
- }
37
- if (open.name !== end[2]) {
38
- throw new Error(`@clint:end ${end[2]} at line ${i + 1} does not match open @clint:begin ${open.name}`);
39
- }
40
- regions.push({
41
- name: open.name,
42
- body: lines.slice(bodyStart, i),
43
- indent: open.indent,
44
- beginLine: open.beginLine,
45
- endLine: i,
46
- });
47
- open = null;
48
- }
49
- }
50
- if (open) {
51
- throw new Error(`unterminated @clint:begin ${open.name}`);
52
- }
53
- return regions;
54
- }
55
- /**
56
- * Replace every region in `target` that also exists in `source` with the
57
- * `source` region's body. Leaves regions present in `target` but not `source`
58
- * untouched. Ignores regions in `source` missing from `target`.
59
- *
60
- * Returns the rewritten file content.
61
- */
62
- export function spliceMarkerRegions(target, source) {
63
- const sourceRegions = parseMarkerRegions(source);
64
- const sourceByName = new Map();
65
- for (const r of sourceRegions)
66
- sourceByName.set(r.name, r);
67
- const targetRegions = parseMarkerRegions(target);
68
- if (targetRegions.length === 0)
69
- return target;
70
- const lines = target.split('\n');
71
- // Apply replacements from last to first so line indices stay valid.
72
- const sorted = [...targetRegions].sort((a, b) => b.beginLine - a.beginLine);
73
- for (const region of sorted) {
74
- const fresh = sourceByName.get(region.name);
75
- if (!fresh)
76
- continue;
77
- // Replace the body lines (exclusive of the begin/end marker lines).
78
- const bodyLen = region.endLine - region.beginLine - 1;
79
- lines.splice(region.beginLine + 1, bodyLen, ...fresh.body);
80
- }
81
- return lines.join('\n');
82
- }
83
- /** Convenience — true if `content` contains at least one `@clint:begin`. */
84
- export function hasMarkers(content) {
85
- return /^[ \t]*\/\/\s*@clint:begin\s+\S+\s*$/m.test(content);
86
- }
1
+ export { parseMarkerRegions, spliceMarkerRegions, hasMarkers, } from '@powerhousedao/ph-clint-dev/codegen/markers';
@@ -1,34 +1 @@
1
- import type { ClintProjectSpec } from '../spec/types.js';
2
- export interface PhInitOptions {
3
- /** Absolute path to the project root. */
4
- targetDir: string;
5
- /** Absolute path to `{targetDir}/{name}-app` (exists with our placeholder). */
6
- appDir: string;
7
- spec: ClintProjectSpec;
8
- /** Logger; defaults to noop. */
9
- log?: (msg: string) => void;
10
- /** Override `ph` binary name (for tests). */
11
- binName?: string;
12
- /** Stdio passthrough (tests pass 'ignore'). */
13
- stdio?: 'inherit' | 'ignore';
14
- }
15
- export interface PhInitResult {
16
- ran: boolean;
17
- exitCode?: number;
18
- reason?: string;
19
- }
20
- export declare function runPhInit(options: PhInitOptions): Promise<PhInitResult>;
21
- export interface PnpmInstallOptions {
22
- /** Directories to run `pnpm install` in, in order. */
23
- dirs: string[];
24
- log?: (msg: string) => void;
25
- /** Override `pnpm` binary name (for tests). */
26
- binName?: string;
27
- stdio?: 'inherit' | 'ignore';
28
- }
29
- export interface PnpmInstallResult {
30
- ran: string[];
31
- skipped: string[];
32
- reason?: string;
33
- }
34
- export declare function runPnpmInstall(options: PnpmInstallOptions): Promise<PnpmInstallResult>;
1
+ export { type RunProcess, type PhInitOptions, type PhInitResult, getPhVersion, runPhInit, patchAppPackageName, type PnpmInstallOptions, type PnpmInstallResult, runPnpmInstall, runPhInstallPackages, } from '@powerhousedao/ph-clint-dev/codegen/scaffold';
@@ -1,60 +1 @@
1
- /**
2
- * Post-generation side-effects: invoke `ph init` to fill in the reactor
3
- * package skeleton, and run `pnpm install` in the relevant sub-projects.
4
- *
5
- * Both steps are opt-out (flags on the init command) and both tolerate
6
- * missing binaries — they never fail the init flow, only emit warnings.
7
- */
8
- import fs from 'node:fs/promises';
9
- import path from 'node:path';
10
- import { hasCommandOnPath, runCommand } from './exec.js';
11
- export async function runPhInit(options) {
12
- const log = options.log ?? (() => { });
13
- const binName = options.binName ?? 'ph';
14
- const appFolder = path.basename(options.appDir);
15
- if (!(await hasCommandOnPath(binName))) {
16
- log(`Skipping \`${binName} init\` — \`${binName}\` is not on PATH. ` +
17
- `Install @powerhousedao/ph-cli and re-run manually inside ${appFolder}/.`);
18
- return { ran: false, reason: 'ph-not-on-path' };
19
- }
20
- // `ph init {name}` creates a fresh directory beside the cwd. Our generator
21
- // placed a `.gitkeep` + README.md placeholder there; clear it out so
22
- // ph init has a blank slate to work with.
23
- await fs.rm(options.appDir, { recursive: true, force: true });
24
- log(`Running \`${binName} init ${appFolder}\` in ${options.targetDir} …`);
25
- const result = await runCommand(binName, [
26
- 'init',
27
- appFolder,
28
- '--pnpm',
29
- '--dev',
30
- ], { cwd: options.targetDir, stdio: options.stdio ?? 'inherit' });
31
- if (result.exitCode !== 0) {
32
- log(`\`${binName} init\` exited with code ${result.exitCode}. ` +
33
- 'You can re-run it manually after resolving the issue.');
34
- }
35
- return { ran: true, exitCode: result.exitCode };
36
- }
37
- export async function runPnpmInstall(options) {
38
- const log = options.log ?? (() => { });
39
- const binName = options.binName ?? 'pnpm';
40
- if (!(await hasCommandOnPath(binName))) {
41
- log(`Skipping \`${binName} install\` — \`${binName}\` is not on PATH. ` +
42
- 'Install pnpm and re-run manually.');
43
- return { ran: [], skipped: options.dirs, reason: 'pnpm-not-on-path' };
44
- }
45
- const ran = [];
46
- for (const dir of options.dirs) {
47
- log(`Running \`${binName} install\` in ${dir} …`);
48
- const result = await runCommand(binName, ['install'], {
49
- cwd: dir,
50
- stdio: options.stdio ?? 'inherit',
51
- });
52
- if (result.exitCode !== 0) {
53
- log(`\`${binName} install\` exited with code ${result.exitCode} in ${dir}. ` +
54
- 'Retry manually once the underlying issue is resolved.');
55
- // Don't abort the whole chain — subsequent dirs may still work.
56
- }
57
- ran.push(dir);
58
- }
59
- return { ran, skipped: [] };
60
- }
1
+ export { getPhVersion, runPhInit, patchAppPackageName, runPnpmInstall, runPhInstallPackages, } from '@powerhousedao/ph-clint-dev/codegen/scaffold';
@@ -1,6 +1 @@
1
- export declare function writeFileEnsuringDir(filePath: string, content: string): Promise<void>;
2
- /**
3
- * Returns true if the directory doesn't exist or only contains ignorable
4
- * entries (`.git`, `.DS_Store`, `.ph/ph-clint-cli/project-spec.json`).
5
- */
6
- export declare function isDirEmptyEnough(dir: string): Promise<boolean>;
1
+ export { writeFileEnsuringDir, isDirEmptyEnough, } from '@powerhousedao/ph-clint-dev/codegen/write';
@@ -1,32 +1 @@
1
- /**
2
- * Low-level file-writing helpers for the code generator.
3
- */
4
- import fs from 'node:fs/promises';
5
- import path from 'node:path';
6
- export async function writeFileEnsuringDir(filePath, content) {
7
- await fs.mkdir(path.dirname(filePath), { recursive: true });
8
- await fs.writeFile(filePath, content, 'utf8');
9
- }
10
- function isEnoent(err) {
11
- return (!!err &&
12
- typeof err === 'object' &&
13
- 'code' in err &&
14
- err.code === 'ENOENT');
15
- }
16
- /**
17
- * Returns true if the directory doesn't exist or only contains ignorable
18
- * entries (`.git`, `.DS_Store`, `.ph/ph-clint-cli/project-spec.json`).
19
- */
20
- export async function isDirEmptyEnough(dir) {
21
- let entries;
22
- try {
23
- entries = await fs.readdir(dir);
24
- }
25
- catch (err) {
26
- if (isEnoent(err))
27
- return true;
28
- throw err;
29
- }
30
- const ignorable = new Set(['.git', '.DS_Store', '.ph']);
31
- return entries.every((entry) => ignorable.has(entry));
32
- }
1
+ export { writeFileEnsuringDir, isDirEmptyEnough, } from '@powerhousedao/ph-clint-dev/codegen/write';
@@ -4,4 +4,66 @@ export declare const build: import("@powerhousedao/ph-clint").Command<z.ZodObjec
4
4
  verbose: z.ZodDefault<z.ZodBoolean>;
5
5
  }, z.core.$strip>, {
6
6
  text: string;
7
- }, Record<string, unknown>>;
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
+ addSupportedResource: (input: import("@powerhousedao/ph-clint-app").AddSupportedResourceInput) => import("@powerhousedao/ph-clint-app").AddSupportedResourceAction;
17
+ removeSupportedResource: (input: import("@powerhousedao/ph-clint-app").RemoveSupportedResourceInput) => import("@powerhousedao/ph-clint-app").RemoveSupportedResourceAction;
18
+ setProxyEnabled: (input: import("@powerhousedao/ph-clint-app").SetProxyEnabledInput) => import("@powerhousedao/ph-clint-app").SetProxyEnabledAction;
19
+ setObservabilityEnabled: (input: import("@powerhousedao/ph-clint-app").SetObservabilityEnabledInput) => import("@powerhousedao/ph-clint-app").SetObservabilityEnabledAction;
20
+ importSpec: (input: import("@powerhousedao/ph-clint-app").ImportSpecInput) => import("@powerhousedao/ph-clint-app").ImportSpecAction;
21
+ bumpVersion: (input: import("@powerhousedao/ph-clint-app").BumpVersionInput) => import("@powerhousedao/ph-clint-app").BumpVersionAction;
22
+ publishDev: (input: import("@powerhousedao/ph-clint-app").PublishDevInput) => import("@powerhousedao/ph-clint-app").PublishDevAction;
23
+ publishStaging: (input: import("@powerhousedao/ph-clint-app").PublishStagingInput) => import("@powerhousedao/ph-clint-app").PublishStagingAction;
24
+ publishProduction: (input: import("@powerhousedao/ph-clint-app").PublishProductionInput) => import("@powerhousedao/ph-clint-app").PublishProductionAction;
25
+ setPublishStatus: (input: import("@powerhousedao/ph-clint-app").SetPublishStatusInput) => import("@powerhousedao/ph-clint-app").SetPublishStatusAction;
26
+ addExternalSkill: (input: import("@powerhousedao/ph-clint-app").AddExternalSkillInput) => import("@powerhousedao/ph-clint-app").AddExternalSkillAction;
27
+ removeExternalSkill: (input: import("@powerhousedao/ph-clint-app").RemoveExternalSkillInput) => import("@powerhousedao/ph-clint-app").RemoveExternalSkillAction;
28
+ setExternalSkillName: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillNameInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillNameAction;
29
+ setExternalSkillGithubUrl: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlAction;
30
+ addPowerhousePackage: (input: import("@powerhousedao/ph-clint-app").AddPowerhousePackageInput) => import("@powerhousedao/ph-clint-app").AddPowerhousePackageAction;
31
+ removePowerhousePackage: (input: import("@powerhousedao/ph-clint-app").RemovePowerhousePackageInput) => import("@powerhousedao/ph-clint-app").RemovePowerhousePackageAction;
32
+ addPackageDocumentType: (input: import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeAction;
33
+ removePackageDocumentType: (input: import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeAction;
34
+ setPackageVersion: (input: import("@powerhousedao/ph-clint-app").SetPackageVersionInput) => import("@powerhousedao/ph-clint-app").SetPackageVersionAction;
35
+ enableRoutine: (input: import("@powerhousedao/ph-clint-app").EnableRoutineInput) => import("@powerhousedao/ph-clint-app").EnableRoutineAction;
36
+ disableRoutine: (input: import("@powerhousedao/ph-clint-app").DisableRoutineInput) => import("@powerhousedao/ph-clint-app").DisableRoutineAction;
37
+ enableMastra: (input: import("@powerhousedao/ph-clint-app").EnableMastraInput) => import("@powerhousedao/ph-clint-app").EnableMastraAction;
38
+ disableMastra: (input: import("@powerhousedao/ph-clint-app").DisableMastraInput) => import("@powerhousedao/ph-clint-app").DisableMastraAction;
39
+ setAgentId: (input: import("@powerhousedao/ph-clint-app").SetAgentIdInput) => import("@powerhousedao/ph-clint-app").SetAgentIdAction;
40
+ setAgentName: (input: import("@powerhousedao/ph-clint-app").SetAgentNameInput) => import("@powerhousedao/ph-clint-app").SetAgentNameAction;
41
+ addModel: (input: import("@powerhousedao/ph-clint-app").AddModelInput) => import("@powerhousedao/ph-clint-app").AddModelAction;
42
+ removeModel: (input: import("@powerhousedao/ph-clint-app").RemoveModelInput) => import("@powerhousedao/ph-clint-app").RemoveModelAction;
43
+ setDefaultModel: (input: import("@powerhousedao/ph-clint-app").SetDefaultModelInput) => import("@powerhousedao/ph-clint-app").SetDefaultModelAction;
44
+ addProfile: (input: import("@powerhousedao/ph-clint-app").AddProfileInput) => import("@powerhousedao/ph-clint-app").AddProfileAction;
45
+ updateProfile: (input: import("@powerhousedao/ph-clint-app").UpdateProfileInput) => import("@powerhousedao/ph-clint-app").UpdateProfileAction;
46
+ removeProfile: (input: import("@powerhousedao/ph-clint-app").RemoveProfileInput) => import("@powerhousedao/ph-clint-app").RemoveProfileAction;
47
+ reorderProfiles: (input: import("@powerhousedao/ph-clint-app").ReorderProfilesInput) => import("@powerhousedao/ph-clint-app").ReorderProfilesAction;
48
+ setAgentDescription: (input: import("@powerhousedao/ph-clint-app").SetAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").SetAgentDescriptionAction;
49
+ setAgentImage: (input: import("@powerhousedao/ph-clint-app").SetAgentImageInput) => import("@powerhousedao/ph-clint-app").SetAgentImageAction;
50
+ clearAgentImage: (input: import("@powerhousedao/ph-clint-app").ClearAgentImageInput) => import("@powerhousedao/ph-clint-app").ClearAgentImageAction;
51
+ setEnableChat: (input: import("@powerhousedao/ph-clint-app").SetEnableChatInput) => import("@powerhousedao/ph-clint-app").SetEnableChatAction;
52
+ setPowerhouseLevel: (input: import("@powerhousedao/ph-clint-app").SetPowerhouseLevelInput) => import("@powerhousedao/ph-clint-app").SetPowerhouseLevelAction;
53
+ setDescription: (input: import("@powerhousedao/ph-clint-app").SetDescriptionInput) => import("@powerhousedao/ph-clint-app").SetDescriptionAction;
54
+ setVersion: (input: import("@powerhousedao/ph-clint-app").SetVersionInput) => import("@powerhousedao/ph-clint-app").SetVersionAction;
55
+ setPackageIdentifier: (input: import("@powerhousedao/ph-clint-app").SetPackageIdentifierInput) => import("@powerhousedao/ph-clint-app").SetPackageIdentifierAction;
56
+ setName: (name: string | {
57
+ name: string;
58
+ }) => import("document-model").SetNameAction;
59
+ undo: (count?: number, scope?: string) => import("document-model").UndoAction;
60
+ redo: (count?: number, scope?: string) => import("document-model").RedoAction;
61
+ prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
62
+ loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
63
+ name: string;
64
+ }, operations: number) => import("document-model").LoadStateAction;
65
+ noop: (scope?: string) => import("document-model").NOOPAction;
66
+ };
67
+ readonly utils: import("document-model").DocumentModelUtils<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
68
+ readonly documentModel: import("document-model").DocumentModelPHState;
69
+ }]>>;
@@ -1,50 +1,33 @@
1
1
  import path from 'node:path';
2
- import { spawn } from 'node:child_process';
3
- import { defineCommand } from '@powerhousedao/ph-clint';
2
+ import { defineCommand } from '../framework.js';
4
3
  import { z } from 'zod';
5
4
  import { detectLayout } from '@powerhousedao/ph-clint-dev';
6
5
  const inputSchema = z.object({
7
6
  dir: z.string().optional().describe('Project root directory (default: cwd)'),
8
7
  verbose: z.boolean().default(false),
9
8
  });
10
- function execInDir(dir, cmd, verbose) {
11
- return new Promise((resolve, reject) => {
12
- const proc = spawn(cmd, {
13
- cwd: dir,
14
- shell: true,
15
- stdio: verbose ? 'inherit' : 'pipe',
16
- });
17
- let stderr = '';
18
- if (!verbose && proc.stderr) {
19
- proc.stderr.on('data', (data) => {
20
- stderr += data.toString();
21
- });
22
- }
23
- proc.on('close', (code) => {
24
- if (code === 0)
25
- resolve();
26
- else
27
- reject(new Error(`Command "${cmd}" failed in ${dir} (exit ${code})${stderr ? `:\n${stderr}` : ''}`));
28
- });
29
- proc.on('error', (err) => reject(err));
30
- });
31
- }
32
9
  export const build = defineCommand({
33
10
  id: 'clint-project-build',
34
11
  description: 'Build all packages in the project',
35
12
  inputSchema,
36
- execute: async (input, { workdir, stdout }) => {
13
+ execute: async (input, { workdir, stdout, runProcess }) => {
37
14
  const dir = path.resolve(input.dir ?? workdir);
38
15
  const layout = detectLayout(dir);
39
16
  if (layout?.type === 'split') {
40
17
  stdout(`Building app package (${layout.app})...\n`);
41
- await execInDir(layout.app, 'pnpm build', input.verbose);
18
+ const appResult = await runProcess('pnpm build', { cwd: layout.app, timeout: 120_000 });
19
+ if (!appResult.success)
20
+ return { text: `App build failed.` };
42
21
  stdout(`Building cli package (${layout.cli})...\n`);
43
- await execInDir(layout.cli, 'pnpm build', input.verbose);
22
+ const cliResult = await runProcess('pnpm build', { cwd: layout.cli, timeout: 120_000 });
23
+ if (!cliResult.success)
24
+ return { text: `CLI build failed.` };
44
25
  }
45
26
  else {
46
27
  stdout(`Building project...\n`);
47
- await execInDir(layout?.cli ?? dir, 'pnpm build', input.verbose);
28
+ const result = await runProcess('pnpm build', { cwd: layout?.cli ?? dir, timeout: 120_000 });
29
+ if (!result.success)
30
+ return { text: `Build failed.` };
48
31
  }
49
32
  return { text: 'Build complete.' };
50
33
  },
@@ -7,8 +7,8 @@ declare const inputSchema: z.ZodObject<{
7
7
  enablePowerhouse: z.ZodDefault<z.ZodBoolean>;
8
8
  enableMastra: z.ZodDefault<z.ZodBoolean>;
9
9
  enableRoutine: z.ZodDefault<z.ZodBoolean>;
10
+ enableObservability: z.ZodDefault<z.ZodBoolean>;
10
11
  force: z.ZodDefault<z.ZodBoolean>;
11
- skipPhInit: z.ZodDefault<z.ZodBoolean>;
12
12
  skipInstall: z.ZodDefault<z.ZodBoolean>;
13
13
  }, z.core.$strip>;
14
14
  type InitInput = z.output<typeof inputSchema>;
@@ -20,8 +20,8 @@ export declare const init: import("@powerhousedao/ph-clint").Command<z.ZodObject
20
20
  enablePowerhouse: z.ZodDefault<z.ZodBoolean>;
21
21
  enableMastra: z.ZodDefault<z.ZodBoolean>;
22
22
  enableRoutine: z.ZodDefault<z.ZodBoolean>;
23
+ enableObservability: z.ZodDefault<z.ZodBoolean>;
23
24
  force: z.ZodDefault<z.ZodBoolean>;
24
- skipPhInit: z.ZodDefault<z.ZodBoolean>;
25
25
  skipInstall: z.ZodDefault<z.ZodBoolean>;
26
26
  }, z.core.$strip>, {
27
27
  text: string;
@@ -35,23 +35,113 @@ export declare const init: import("@powerhousedao/ph-clint").Command<z.ZodObject
35
35
  version: string;
36
36
  description: string;
37
37
  features: {
38
- powerhouse: {
39
- enabled: boolean;
40
- switchboard: boolean;
41
- connect: boolean;
42
- };
38
+ powerhouse: "Disabled" | "Reactor" | "Switchboard" | "Connect";
43
39
  mastra: {
44
40
  enabled: boolean;
41
+ agentId: string | null;
42
+ agentName: string | null;
43
+ agentDescription: string | null;
44
+ agentImage: string | null;
45
+ models: {
46
+ id: string;
47
+ isDefault: boolean;
48
+ }[];
49
+ profiles: {
50
+ id: string;
51
+ title: string;
52
+ content: string;
53
+ }[];
54
+ common: {
55
+ enableChat: boolean;
56
+ };
45
57
  };
46
58
  routine: {
47
59
  enabled: boolean;
48
60
  };
49
61
  };
50
- documentTypes: string[];
62
+ packages: {
63
+ id: string;
64
+ packageName: string;
65
+ documentTypes: string[];
66
+ version: string | null;
67
+ }[];
68
+ externalSkills: {
69
+ id: string;
70
+ name: string;
71
+ githubUrl: string;
72
+ }[];
73
+ deployment: {
74
+ proxyEnabled: boolean;
75
+ observabilityEnabled: boolean;
76
+ supportedResources: string[];
77
+ };
51
78
  scope?: string | undefined;
52
- bin?: string | undefined;
79
+ documentId?: string | undefined;
80
+ documentType?: string | undefined;
53
81
  };
54
82
  fileCount: number;
55
83
  };
56
- }, Record<string, unknown>>;
84
+ }, {
85
+ model: string;
86
+ devServicePort: number;
87
+ phVersion: string;
88
+ apiKey?: string | undefined;
89
+ }, import("@powerhousedao/ph-clint").InferRegistry<readonly [{
90
+ readonly version: 1;
91
+ readonly reducer: import("document-model").Reducer<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
92
+ readonly actions: {
93
+ addSupportedResource: (input: import("@powerhousedao/ph-clint-app").AddSupportedResourceInput) => import("@powerhousedao/ph-clint-app").AddSupportedResourceAction;
94
+ removeSupportedResource: (input: import("@powerhousedao/ph-clint-app").RemoveSupportedResourceInput) => import("@powerhousedao/ph-clint-app").RemoveSupportedResourceAction;
95
+ setProxyEnabled: (input: import("@powerhousedao/ph-clint-app").SetProxyEnabledInput) => import("@powerhousedao/ph-clint-app").SetProxyEnabledAction;
96
+ setObservabilityEnabled: (input: import("@powerhousedao/ph-clint-app").SetObservabilityEnabledInput) => import("@powerhousedao/ph-clint-app").SetObservabilityEnabledAction;
97
+ importSpec: (input: import("@powerhousedao/ph-clint-app").ImportSpecInput) => import("@powerhousedao/ph-clint-app").ImportSpecAction;
98
+ bumpVersion: (input: import("@powerhousedao/ph-clint-app").BumpVersionInput) => import("@powerhousedao/ph-clint-app").BumpVersionAction;
99
+ publishDev: (input: import("@powerhousedao/ph-clint-app").PublishDevInput) => import("@powerhousedao/ph-clint-app").PublishDevAction;
100
+ publishStaging: (input: import("@powerhousedao/ph-clint-app").PublishStagingInput) => import("@powerhousedao/ph-clint-app").PublishStagingAction;
101
+ publishProduction: (input: import("@powerhousedao/ph-clint-app").PublishProductionInput) => import("@powerhousedao/ph-clint-app").PublishProductionAction;
102
+ setPublishStatus: (input: import("@powerhousedao/ph-clint-app").SetPublishStatusInput) => import("@powerhousedao/ph-clint-app").SetPublishStatusAction;
103
+ addExternalSkill: (input: import("@powerhousedao/ph-clint-app").AddExternalSkillInput) => import("@powerhousedao/ph-clint-app").AddExternalSkillAction;
104
+ removeExternalSkill: (input: import("@powerhousedao/ph-clint-app").RemoveExternalSkillInput) => import("@powerhousedao/ph-clint-app").RemoveExternalSkillAction;
105
+ setExternalSkillName: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillNameInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillNameAction;
106
+ setExternalSkillGithubUrl: (input: import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlInput) => import("@powerhousedao/ph-clint-app").SetExternalSkillGithubUrlAction;
107
+ addPowerhousePackage: (input: import("@powerhousedao/ph-clint-app").AddPowerhousePackageInput) => import("@powerhousedao/ph-clint-app").AddPowerhousePackageAction;
108
+ removePowerhousePackage: (input: import("@powerhousedao/ph-clint-app").RemovePowerhousePackageInput) => import("@powerhousedao/ph-clint-app").RemovePowerhousePackageAction;
109
+ addPackageDocumentType: (input: import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").AddPackageDocumentTypeAction;
110
+ removePackageDocumentType: (input: import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeInput) => import("@powerhousedao/ph-clint-app").RemovePackageDocumentTypeAction;
111
+ setPackageVersion: (input: import("@powerhousedao/ph-clint-app").SetPackageVersionInput) => import("@powerhousedao/ph-clint-app").SetPackageVersionAction;
112
+ enableRoutine: (input: import("@powerhousedao/ph-clint-app").EnableRoutineInput) => import("@powerhousedao/ph-clint-app").EnableRoutineAction;
113
+ disableRoutine: (input: import("@powerhousedao/ph-clint-app").DisableRoutineInput) => import("@powerhousedao/ph-clint-app").DisableRoutineAction;
114
+ enableMastra: (input: import("@powerhousedao/ph-clint-app").EnableMastraInput) => import("@powerhousedao/ph-clint-app").EnableMastraAction;
115
+ disableMastra: (input: import("@powerhousedao/ph-clint-app").DisableMastraInput) => import("@powerhousedao/ph-clint-app").DisableMastraAction;
116
+ setAgentId: (input: import("@powerhousedao/ph-clint-app").SetAgentIdInput) => import("@powerhousedao/ph-clint-app").SetAgentIdAction;
117
+ setAgentName: (input: import("@powerhousedao/ph-clint-app").SetAgentNameInput) => import("@powerhousedao/ph-clint-app").SetAgentNameAction;
118
+ addModel: (input: import("@powerhousedao/ph-clint-app").AddModelInput) => import("@powerhousedao/ph-clint-app").AddModelAction;
119
+ removeModel: (input: import("@powerhousedao/ph-clint-app").RemoveModelInput) => import("@powerhousedao/ph-clint-app").RemoveModelAction;
120
+ setDefaultModel: (input: import("@powerhousedao/ph-clint-app").SetDefaultModelInput) => import("@powerhousedao/ph-clint-app").SetDefaultModelAction;
121
+ addProfile: (input: import("@powerhousedao/ph-clint-app").AddProfileInput) => import("@powerhousedao/ph-clint-app").AddProfileAction;
122
+ updateProfile: (input: import("@powerhousedao/ph-clint-app").UpdateProfileInput) => import("@powerhousedao/ph-clint-app").UpdateProfileAction;
123
+ removeProfile: (input: import("@powerhousedao/ph-clint-app").RemoveProfileInput) => import("@powerhousedao/ph-clint-app").RemoveProfileAction;
124
+ reorderProfiles: (input: import("@powerhousedao/ph-clint-app").ReorderProfilesInput) => import("@powerhousedao/ph-clint-app").ReorderProfilesAction;
125
+ setAgentDescription: (input: import("@powerhousedao/ph-clint-app").SetAgentDescriptionInput) => import("@powerhousedao/ph-clint-app").SetAgentDescriptionAction;
126
+ setAgentImage: (input: import("@powerhousedao/ph-clint-app").SetAgentImageInput) => import("@powerhousedao/ph-clint-app").SetAgentImageAction;
127
+ clearAgentImage: (input: import("@powerhousedao/ph-clint-app").ClearAgentImageInput) => import("@powerhousedao/ph-clint-app").ClearAgentImageAction;
128
+ setEnableChat: (input: import("@powerhousedao/ph-clint-app").SetEnableChatInput) => import("@powerhousedao/ph-clint-app").SetEnableChatAction;
129
+ setPowerhouseLevel: (input: import("@powerhousedao/ph-clint-app").SetPowerhouseLevelInput) => import("@powerhousedao/ph-clint-app").SetPowerhouseLevelAction;
130
+ setDescription: (input: import("@powerhousedao/ph-clint-app").SetDescriptionInput) => import("@powerhousedao/ph-clint-app").SetDescriptionAction;
131
+ setVersion: (input: import("@powerhousedao/ph-clint-app").SetVersionInput) => import("@powerhousedao/ph-clint-app").SetVersionAction;
132
+ setPackageIdentifier: (input: import("@powerhousedao/ph-clint-app").SetPackageIdentifierInput) => import("@powerhousedao/ph-clint-app").SetPackageIdentifierAction;
133
+ setName: (name: string | {
134
+ name: string;
135
+ }) => import("document-model").SetNameAction;
136
+ undo: (count?: number, scope?: string) => import("document-model").UndoAction;
137
+ redo: (count?: number, scope?: string) => import("document-model").RedoAction;
138
+ prune: (start?: number, end?: number, scope?: string) => import("document-model").SchemaPruneAction;
139
+ loadState: <TState extends import("document-model").PHBaseState = import("document-model").PHBaseState>(state: TState & {
140
+ name: string;
141
+ }, operations: number) => import("document-model").LoadStateAction;
142
+ noop: (scope?: string) => import("document-model").NOOPAction;
143
+ };
144
+ readonly utils: import("document-model").DocumentModelUtils<import("@powerhousedao/ph-clint-app").PhClintProjectPHState>;
145
+ readonly documentModel: import("document-model").DocumentModelPHState;
146
+ }]>>;
57
147
  export {};