@powerhousedao/ph-clint-cli 0.1.0-dev.10 → 0.1.0-dev.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +53 -16
- package/dist/codegen/index.d.ts +8 -36
- package/dist/codegen/index.js +6 -293
- package/dist/commands/clint-project-build.d.ts +77 -1
- package/dist/commands/clint-project-build.js +11 -28
- package/dist/commands/clint-project-init.d.ts +130 -10
- package/dist/commands/clint-project-init.js +72 -47
- package/dist/commands/clint-project-publish.d.ts +78 -1
- package/dist/commands/clint-project-publish.js +6 -4
- package/dist/commands/clint-project-regen.d.ts +77 -1
- package/dist/commands/clint-project-regen.js +26 -2
- package/dist/commands/clint-skills-sync.d.ts +86 -0
- package/dist/commands/clint-skills-sync.js +56 -0
- package/dist/framework.d.ts +322 -60
- package/dist/framework.gen.d.ts +50 -10
- package/dist/framework.js +1 -5
- package/{prompts/agent-profiles/AgentBase.md → dist/gen/agent-profiles/PhClintDevAgent.md} +1 -1
- package/dist/gen/skills/cli-setup/.cli-docs.md +135 -0
- package/dist/gen/skills/cli-setup/SKILL.md +125 -0
- package/dist/gen/skills/cli-setup/references/00.assess-cli-needs.md +53 -0
- package/dist/gen/skills/cli-setup/references/01.define-config-schema.md +78 -0
- package/dist/gen/skills/cli-setup/references/02.wire-cli.md +141 -0
- package/dist/gen/skills/cli-setup/references/03.add-entrypoint.md +128 -0
- package/dist/gen/skills/cli-setup/references/expected-outcome.md +3 -0
- package/dist/gen/skills/command-definition/.cli-docs.md +84 -0
- package/dist/gen/skills/command-definition/SKILL.md +99 -0
- package/dist/gen/skills/command-definition/references/00.assess-requirements.md +58 -0
- package/dist/gen/skills/command-definition/references/01.define-schema.md +72 -0
- package/dist/gen/skills/command-definition/references/02.implement-execute.md +118 -0
- package/dist/gen/skills/command-definition/references/03.add-prompting.md +54 -0
- package/dist/gen/skills/command-definition/references/expected-outcome.md +3 -0
- package/dist/gen/skills/service-definition/.cli-docs.md +214 -0
- package/dist/gen/skills/service-definition/SKILL.md +148 -0
- package/dist/gen/skills/service-definition/references/00.assess-service.md +69 -0
- package/dist/gen/skills/service-definition/references/01.define-service.md +166 -0
- package/dist/gen/skills/service-definition/references/02.add-preflight.md +132 -0
- package/dist/gen/skills/service-definition/references/03.add-project-scanner.md +82 -0
- package/dist/gen/skills/service-definition/references/04.wire-events.md +120 -0
- package/dist/gen/skills/service-definition/references/expected-outcome.md +3 -0
- package/dist/main.js +0 -0
- package/dist/services/clint-project.js +21 -0
- package/dist/spec/ensure-document.d.ts +17 -0
- package/dist/spec/ensure-document.js +56 -0
- package/dist/spec/file.d.ts +1 -4
- package/dist/spec/file.js +1 -34
- package/dist/spec/from-document.d.ts +4 -1
- package/dist/spec/from-document.js +4 -16
- package/dist/spec/types.d.ts +1 -62
- package/dist/spec/types.js +1 -112
- package/dist/triggers/publish-trigger.d.ts +81 -0
- package/dist/triggers/publish-trigger.js +137 -0
- package/dist/triggers/spec-change.d.ts +60 -18
- package/dist/triggers/spec-change.js +154 -101
- package/package.json +26 -31
- package/dist/codegen/builders/agent-base-md.d.ts +0 -5
- package/dist/codegen/builders/agent-base-md.js +0 -18
- package/dist/codegen/builders/agent-ts.d.ts +0 -9
- package/dist/codegen/builders/agent-ts.js +0 -34
- package/dist/codegen/builders/app-index-ts.d.ts +0 -18
- package/dist/codegen/builders/app-index-ts.js +0 -33
- package/dist/codegen/builders/build-skills-ts.d.ts +0 -4
- package/dist/codegen/builders/build-skills-ts.js +0 -37
- package/dist/codegen/builders/cli-package-json.d.ts +0 -8
- package/dist/codegen/builders/cli-package-json.js +0 -96
- package/dist/codegen/builders/cli-ts.d.ts +0 -7
- package/dist/codegen/builders/cli-ts.js +0 -132
- package/dist/codegen/builders/config-ts.d.ts +0 -8
- package/dist/codegen/builders/config-ts.js +0 -17
- package/dist/codegen/builders/eslint-config-js.d.ts +0 -4
- package/dist/codegen/builders/eslint-config-js.js +0 -13
- package/dist/codegen/builders/framework-gen-ts.d.ts +0 -20
- package/dist/codegen/builders/framework-gen-ts.js +0 -62
- package/dist/codegen/builders/framework-ts.d.ts +0 -21
- package/dist/codegen/builders/framework-ts.js +0 -74
- package/dist/codegen/builders/gitignore.d.ts +0 -4
- package/dist/codegen/builders/gitignore.js +0 -18
- package/dist/codegen/builders/index.d.ts +0 -44
- package/dist/codegen/builders/index.js +0 -61
- package/dist/codegen/builders/jest-config-js.d.ts +0 -4
- package/dist/codegen/builders/jest-config-js.js +0 -19
- package/dist/codegen/builders/main-ts.d.ts +0 -5
- package/dist/codegen/builders/main-ts.js +0 -13
- package/dist/codegen/builders/mastra-index-ts.d.ts +0 -8
- package/dist/codegen/builders/mastra-index-ts.js +0 -30
- package/dist/codegen/builders/publish-config-ts.d.ts +0 -6
- package/dist/codegen/builders/publish-config-ts.js +0 -18
- package/dist/codegen/builders/readme-md.d.ts +0 -5
- package/dist/codegen/builders/readme-md.js +0 -44
- package/dist/codegen/builders/root-package-json.d.ts +0 -10
- package/dist/codegen/builders/root-package-json.js +0 -40
- package/dist/codegen/builders/tsconfig-json.d.ts +0 -4
- package/dist/codegen/builders/tsconfig-json.js +0 -22
- package/dist/codegen/exec.d.ts +0 -20
- package/dist/codegen/exec.js +0 -41
- package/dist/codegen/hashes.d.ts +0 -6
- package/dist/codegen/hashes.js +0 -60
- package/dist/codegen/markers.d.ts +0 -36
- package/dist/codegen/markers.js +0 -86
- package/dist/codegen/migrate/flat-to-split.d.ts +0 -15
- package/dist/codegen/migrate/flat-to-split.js +0 -119
- package/dist/codegen/scaffold.d.ts +0 -34
- package/dist/codegen/scaffold.js +0 -60
- package/dist/codegen/write.d.ts +0 -6
- package/dist/codegen/write.js +0 -32
- package/dist/commands/init.d.ts +0 -57
- package/dist/commands/init.js +0 -168
- package/dist/commands/regen.d.ts +0 -18
- package/dist/commands/regen.js +0 -68
- package/prompts/skills-ext/.gitkeep +0 -0
- package/prompts/skills-tpl/.gitkeep +0 -0
package/dist/cli.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* Everything outside the markers is user-editable and preserved.
|
|
8
8
|
*/
|
|
9
9
|
import path from 'node:path';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { defineCli, buildDefaultReactor, deterministicId } from '@powerhousedao/ph-clint';
|
|
11
|
+
import { z } from 'zod';
|
|
12
12
|
import { CLI_NAME, CLI_VERSION, CLI_ROOT } from './config.js';
|
|
13
13
|
import { configSchema, secretsSchema } from './framework.js';
|
|
14
14
|
// @clint:begin imports
|
|
@@ -19,34 +19,69 @@ import { regen } from './commands/clint-project-regen.js';
|
|
|
19
19
|
import { build } from './commands/clint-project-build.js';
|
|
20
20
|
import { clintProjectPublish } from './commands/clint-project-publish.js';
|
|
21
21
|
import { clintProject } from './services/clint-project.js';
|
|
22
|
+
import { skillsSync } from './commands/clint-skills-sync.js';
|
|
22
23
|
import { specChangeTrigger } from './triggers/spec-change.js';
|
|
24
|
+
import { publishTrigger } from './triggers/publish-trigger.js';
|
|
23
25
|
// @clint:end imports
|
|
24
|
-
// Connect (ph connect) must run inside the Reactor Package (ph-clint-app).
|
|
25
|
-
const appDir = path.resolve(CLI_ROOT, '../ph-clint-app');
|
|
26
|
-
function resolveConnectAssets(dir) {
|
|
27
|
-
const assetsDir = path.join(dir, 'dist', 'connect');
|
|
28
|
-
return existsSync(path.join(assetsDir, 'index.html')) ? assetsDir : undefined;
|
|
29
|
-
}
|
|
30
26
|
export const cli = defineCli({
|
|
31
27
|
name: CLI_NAME,
|
|
32
28
|
version: CLI_VERSION,
|
|
29
|
+
root: CLI_ROOT,
|
|
33
30
|
description: `${CLI_NAME} v${CLI_VERSION} — scaffold and maintain ph-clint implementation projects`,
|
|
34
31
|
configSchema,
|
|
35
32
|
secretsSchema,
|
|
36
33
|
// @clint:begin commands
|
|
37
|
-
commands: [init, regen, build, clintProjectPublish],
|
|
34
|
+
commands: [init, regen, build, clintProjectPublish, skillsSync],
|
|
38
35
|
// @clint:end commands
|
|
39
36
|
// @clint:begin services
|
|
40
37
|
services: [clintProject],
|
|
41
38
|
// @clint:end services
|
|
42
39
|
// @clint:begin triggers
|
|
43
|
-
triggers: [specChangeTrigger],
|
|
40
|
+
triggers: [specChangeTrigger, publishTrigger],
|
|
41
|
+
routine: { id: 'triggers', name: 'Triggers' },
|
|
44
42
|
// @clint:end triggers
|
|
45
43
|
// @clint:begin prompts
|
|
46
44
|
prompts: {
|
|
47
|
-
|
|
48
|
-
agents: {
|
|
49
|
-
|
|
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
|
+
},
|
|
50
85
|
},
|
|
51
86
|
// @clint:end prompts
|
|
52
87
|
// @clint:begin events
|
|
@@ -72,12 +107,14 @@ export const cli = defineCli({
|
|
|
72
107
|
// @clint:begin reactor
|
|
73
108
|
cli.configureReactor({
|
|
74
109
|
create: (ctx) => buildDefaultReactor(ctx, {
|
|
75
|
-
documentModels,
|
|
76
|
-
|
|
110
|
+
documentModels: [...documentModels],
|
|
111
|
+
drives: [
|
|
112
|
+
{ name: 'Clint Folders', role: 'personal', id: deterministicId(CLI_NAME, 'personal-drive') },
|
|
113
|
+
],
|
|
77
114
|
subscriptions: { documentTypes: ['powerhouse/ph-clint-project'] },
|
|
78
115
|
}),
|
|
79
116
|
switchboard: { enabled: true },
|
|
80
|
-
connect: { enabled: true
|
|
117
|
+
connect: { enabled: true },
|
|
81
118
|
});
|
|
82
119
|
// @clint:end reactor
|
|
83
120
|
// @clint:begin mastra
|
package/dist/codegen/index.d.ts
CHANGED
|
@@ -1,39 +1,11 @@
|
|
|
1
|
-
import { type ClintProjectSpec } from '../spec/types.js';
|
|
2
|
-
export type GenerateMode = 'create' | 'update' | 'auto';
|
|
3
|
-
export interface GenerateProjectOptions {
|
|
4
|
-
/** Absolute path to the project root. */
|
|
5
|
-
targetDir: string;
|
|
6
|
-
spec: ClintProjectSpec;
|
|
7
|
-
/** Defaults to `'auto'` — create if no persisted spec, else update. */
|
|
8
|
-
mode?: GenerateMode;
|
|
9
|
-
/** Create mode: allow writing into a non-empty directory. */
|
|
10
|
-
allowNonEmpty?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Update mode: overwrite user-edited files (hash-mismatch) anyway.
|
|
13
|
-
* Also relaxes the git-dirty guard on flat → split migration.
|
|
14
|
-
*/
|
|
15
|
-
force?: boolean;
|
|
16
|
-
/** Optional warning sink (diagnostics, not errors). */
|
|
17
|
-
onWarn?: (msg: string) => void;
|
|
18
|
-
}
|
|
19
|
-
export interface GeneratedFile {
|
|
20
|
-
absolutePath: string;
|
|
21
|
-
relativePath: string;
|
|
22
|
-
}
|
|
23
|
-
export interface GenerateProjectResult {
|
|
24
|
-
mode: 'create' | 'update';
|
|
25
|
-
/** Files newly written or rewritten. */
|
|
26
|
-
files: GeneratedFile[];
|
|
27
|
-
/** Files skipped because the user had edited them. */
|
|
28
|
-
skipped: GeneratedFile[];
|
|
29
|
-
/** Files removed because the new spec no longer emits them. */
|
|
30
|
-
deleted: GeneratedFile[];
|
|
31
|
-
/** True if a flat → split migration ran. */
|
|
32
|
-
migrated: boolean;
|
|
33
|
-
cliDir: string;
|
|
34
|
-
appDir: string | null;
|
|
35
|
-
}
|
|
36
1
|
/**
|
|
37
|
-
*
|
|
2
|
+
* Re-exports from @powerhousedao/ph-clint-dev/codegen with CLI_VERSION default.
|
|
38
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
|
+
}
|
|
39
11
|
export declare function generateProject(options: GenerateProjectOptions): Promise<GenerateProjectResult>;
|
package/dist/codegen/index.js
CHANGED
|
@@ -1,298 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Takes a `ClintProjectSpec` + target directory and reconciles the on-disk
|
|
5
|
-
* project tree with it.
|
|
6
|
-
*
|
|
7
|
-
* Two modes:
|
|
8
|
-
*
|
|
9
|
-
* - **create** — the target dir is empty (or only contains ignorable
|
|
10
|
-
* artefacts). Every templated file is written fresh. Refuses to
|
|
11
|
-
* overwrite existing non-empty state unless `allowNonEmpty`.
|
|
12
|
-
*
|
|
13
|
-
* - **update** — a previous run's spec exists at
|
|
14
|
-
* `.ph/ph-clint-cli/project-spec.json`. Re-runs the builders, then for
|
|
15
|
-
* each emitted file:
|
|
16
|
-
* - files containing `@clint:begin/@clint:end` markers (today: just
|
|
17
|
-
* `src/cli.ts`) have their marker regions spliced in-place, leaving
|
|
18
|
-
* user code outside markers untouched;
|
|
19
|
-
* - files without markers are overwritten iff their on-disk hash still
|
|
20
|
-
* matches the hash stored from the previous write (user-edited files
|
|
21
|
-
* are skipped and surfaced via `onWarn`);
|
|
22
|
-
* - files the new spec no longer emits are removed if their hash still
|
|
23
|
-
* matches.
|
|
24
|
-
*
|
|
25
|
-
* A spec flip of `features.powerhouse.enabled` from `false` to `true`
|
|
26
|
-
* triggers the flat → split migration before the update flow runs.
|
|
27
|
-
*
|
|
28
|
-
* Mode is auto-detected by the presence of the persisted spec.
|
|
29
|
-
*/
|
|
30
|
-
import fs from 'node:fs/promises';
|
|
31
|
-
import path from 'node:path';
|
|
32
|
-
import { getAppFolderName, getCliFolderName, } from '../spec/types.js';
|
|
33
|
-
import { getSpecPath, readProjectSpec, writeProjectSpec, } from '../spec/file.js';
|
|
34
|
-
import { hashContent, hashFile, readHashes, writeHashes, } from './hashes.js';
|
|
35
|
-
import { hasMarkers, spliceMarkerRegions } from './markers.js';
|
|
36
|
-
import { writeFileEnsuringDir, isDirEmptyEnough } from './write.js';
|
|
37
|
-
import { migrateFlatToSplit } from './migrate/flat-to-split.js';
|
|
38
|
-
import { CLI_FILE_BUILDERS, buildReadme, buildRootPackageJson, buildPublishConfigTs, buildAppIndexTs, } from './builders/index.js';
|
|
39
|
-
/**
|
|
40
|
-
* Generate / reconcile a project at `targetDir` from the given spec.
|
|
2
|
+
* Re-exports from @powerhousedao/ph-clint-dev/codegen with CLI_VERSION default.
|
|
41
3
|
*/
|
|
4
|
+
import { generateProject as _generateProject, } from '@powerhousedao/ph-clint-dev/codegen';
|
|
5
|
+
import { CLI_VERSION } from '../config.js';
|
|
42
6
|
export async function generateProject(options) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const resolvedMode = resolveMode(options.mode ?? 'auto', existingSpec !== null);
|
|
47
|
-
// Flat → split migration, if needed. Runs BEFORE we compute planned files
|
|
48
|
-
// so the hash record and on-disk state are already in split-layout shape
|
|
49
|
-
// by the time the normal reconciliation runs.
|
|
50
|
-
let migrated = false;
|
|
51
|
-
if (resolvedMode === 'update' &&
|
|
52
|
-
existingSpec &&
|
|
53
|
-
!existingSpec.features.powerhouse.enabled &&
|
|
54
|
-
spec.features.powerhouse.enabled) {
|
|
55
|
-
await migrateFlatToSplit({
|
|
56
|
-
targetDir,
|
|
57
|
-
spec,
|
|
58
|
-
force: options.force,
|
|
59
|
-
onWarn: warn,
|
|
60
|
-
});
|
|
61
|
-
migrated = true;
|
|
62
|
-
}
|
|
63
|
-
// Dispatch to the mode-specific flow.
|
|
64
|
-
if (resolvedMode === 'create') {
|
|
65
|
-
return runCreate(options, warn);
|
|
66
|
-
}
|
|
67
|
-
return runUpdate(options, warn, migrated);
|
|
68
|
-
}
|
|
69
|
-
function resolveMode(requested, specExists) {
|
|
70
|
-
if (requested === 'create')
|
|
71
|
-
return 'create';
|
|
72
|
-
if (requested === 'update')
|
|
73
|
-
return 'update';
|
|
74
|
-
return specExists ? 'update' : 'create';
|
|
75
|
-
}
|
|
76
|
-
/** Build the list of files the new spec would emit, with their content. */
|
|
77
|
-
function planFiles(spec, targetDir) {
|
|
78
|
-
const split = spec.features.powerhouse.enabled;
|
|
79
|
-
const cliDir = split ? path.join(targetDir, getCliFolderName(spec)) : targetDir;
|
|
80
|
-
const appDir = split ? path.join(targetDir, getAppFolderName(spec)) : null;
|
|
81
|
-
const planned = [];
|
|
82
|
-
for (const builder of CLI_FILE_BUILDERS) {
|
|
83
|
-
const content = builder.build(spec);
|
|
84
|
-
if (content === null)
|
|
85
|
-
continue;
|
|
86
|
-
const abs = path.join(cliDir, builder.relativePath);
|
|
87
|
-
planned.push({
|
|
88
|
-
relativePath: path.relative(targetDir, abs),
|
|
89
|
-
absolutePath: abs,
|
|
90
|
-
content,
|
|
91
|
-
initOnly: builder.initOnly,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
// Project-root README — always at the top level.
|
|
95
|
-
const readmeAbs = path.join(targetDir, 'README.md');
|
|
96
|
-
planned.push({
|
|
97
|
-
relativePath: 'README.md',
|
|
98
|
-
absolutePath: readmeAbs,
|
|
99
|
-
content: buildReadme(spec),
|
|
7
|
+
return _generateProject({
|
|
8
|
+
...options,
|
|
9
|
+
context: options.context ?? { toolVersion: CLI_VERSION },
|
|
100
10
|
});
|
|
101
|
-
// Split-layout only: root package.json + app placeholder files.
|
|
102
|
-
if (split && appDir) {
|
|
103
|
-
const rootPkg = path.join(targetDir, 'package.json');
|
|
104
|
-
planned.push({
|
|
105
|
-
relativePath: 'package.json',
|
|
106
|
-
absolutePath: rootPkg,
|
|
107
|
-
content: buildRootPackageJson(spec),
|
|
108
|
-
});
|
|
109
|
-
const publishConfig = path.join(targetDir, 'publish.config.ts');
|
|
110
|
-
planned.push({
|
|
111
|
-
relativePath: 'publish.config.ts',
|
|
112
|
-
absolutePath: publishConfig,
|
|
113
|
-
content: buildPublishConfigTs(spec),
|
|
114
|
-
});
|
|
115
|
-
const appGitkeep = path.join(appDir, '.gitkeep');
|
|
116
|
-
planned.push({
|
|
117
|
-
relativePath: path.relative(targetDir, appGitkeep),
|
|
118
|
-
absolutePath: appGitkeep,
|
|
119
|
-
content: '',
|
|
120
|
-
});
|
|
121
|
-
const appReadme = path.join(appDir, 'README.md');
|
|
122
|
-
planned.push({
|
|
123
|
-
relativePath: path.relative(targetDir, appReadme),
|
|
124
|
-
absolutePath: appReadme,
|
|
125
|
-
content: buildAppReadmeContent(spec),
|
|
126
|
-
});
|
|
127
|
-
// Top-level barrel for the reactor package — lets impl code import from
|
|
128
|
-
// `{name}-app` instead of drilling into `document-models/<slug>/v1/gen`.
|
|
129
|
-
const appIndex = buildAppIndexTs(spec);
|
|
130
|
-
if (appIndex !== null) {
|
|
131
|
-
const appIndexAbs = path.join(appDir, 'index.ts');
|
|
132
|
-
planned.push({
|
|
133
|
-
relativePath: path.relative(targetDir, appIndexAbs),
|
|
134
|
-
absolutePath: appIndexAbs,
|
|
135
|
-
content: appIndex,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return { planned, cliDir, appDir };
|
|
140
|
-
}
|
|
141
|
-
function buildAppReadmeContent(spec) {
|
|
142
|
-
return [
|
|
143
|
-
`# ${spec.name}-app`,
|
|
144
|
-
'',
|
|
145
|
-
'Powerhouse reactor-package for this project. Scaffold it with:',
|
|
146
|
-
'',
|
|
147
|
-
'```sh',
|
|
148
|
-
`cd ${spec.name}-app`,
|
|
149
|
-
'ph init',
|
|
150
|
-
'```',
|
|
151
|
-
'',
|
|
152
|
-
'Then run `pnpm install` at the project root.',
|
|
153
|
-
'',
|
|
154
|
-
].join('\n');
|
|
155
|
-
}
|
|
156
|
-
/** Create mode — empty target dir, write everything fresh. */
|
|
157
|
-
async function runCreate(options, _warn) {
|
|
158
|
-
const { targetDir, spec } = options;
|
|
159
|
-
if (!options.allowNonEmpty) {
|
|
160
|
-
const empty = await isDirEmptyEnough(targetDir);
|
|
161
|
-
if (!empty) {
|
|
162
|
-
throw new Error(`target directory ${targetDir} is not empty (pass allowNonEmpty or --force to override)`);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const { planned, cliDir, appDir } = planFiles(spec, targetDir);
|
|
166
|
-
const hashes = {};
|
|
167
|
-
const files = [];
|
|
168
|
-
for (const p of planned) {
|
|
169
|
-
await writeFileEnsuringDir(p.absolutePath, p.content);
|
|
170
|
-
hashes[p.relativePath] = hashContent(p.content);
|
|
171
|
-
files.push({ absolutePath: p.absolutePath, relativePath: p.relativePath });
|
|
172
|
-
}
|
|
173
|
-
await writeProjectSpec(targetDir, spec);
|
|
174
|
-
files.push({
|
|
175
|
-
absolutePath: getSpecPath(targetDir),
|
|
176
|
-
relativePath: path.relative(targetDir, getSpecPath(targetDir)),
|
|
177
|
-
});
|
|
178
|
-
await writeHashes(targetDir, hashes);
|
|
179
|
-
return {
|
|
180
|
-
mode: 'create',
|
|
181
|
-
files,
|
|
182
|
-
skipped: [],
|
|
183
|
-
deleted: [],
|
|
184
|
-
migrated: false,
|
|
185
|
-
cliDir,
|
|
186
|
-
appDir,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
/** Update mode — reconcile against an existing project. */
|
|
190
|
-
async function runUpdate(options, warn, migrated) {
|
|
191
|
-
const { targetDir, spec } = options;
|
|
192
|
-
const force = !!options.force;
|
|
193
|
-
const { planned, cliDir, appDir } = planFiles(spec, targetDir);
|
|
194
|
-
const plannedByKey = new Map(planned.map((p) => [p.relativePath, p]));
|
|
195
|
-
const previous = await readHashes(targetDir);
|
|
196
|
-
const next = {};
|
|
197
|
-
const files = [];
|
|
198
|
-
const skipped = [];
|
|
199
|
-
const deleted = [];
|
|
200
|
-
// Step 1: write / patch / skip each planned file.
|
|
201
|
-
for (const p of planned) {
|
|
202
|
-
if (p.initOnly) {
|
|
203
|
-
// User-owned files (e.g. `src/framework.ts` with its `configSchema`)
|
|
204
|
-
// are emitted only on create. In update mode we never overwrite them
|
|
205
|
-
// and never re-create them if missing — the user may have deliberately
|
|
206
|
-
// deleted or inlined them. Keep whatever hash the previous run stored
|
|
207
|
-
// so the deletion pass (step 2) still considers them "ours".
|
|
208
|
-
const stored = previous[p.relativePath];
|
|
209
|
-
if (stored !== undefined)
|
|
210
|
-
next[p.relativePath] = stored;
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
const existing = await hashFile(p.absolutePath);
|
|
214
|
-
if (existing === null) {
|
|
215
|
-
// Not yet on disk — fresh write.
|
|
216
|
-
await writeFileEnsuringDir(p.absolutePath, p.content);
|
|
217
|
-
next[p.relativePath] = hashContent(p.content);
|
|
218
|
-
files.push({
|
|
219
|
-
absolutePath: p.absolutePath,
|
|
220
|
-
relativePath: p.relativePath,
|
|
221
|
-
});
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
// File exists. Decide how to update it.
|
|
225
|
-
if (hasMarkers(p.content)) {
|
|
226
|
-
const existingContent = await fs.readFile(p.absolutePath, 'utf8');
|
|
227
|
-
const patched = hasMarkers(existingContent)
|
|
228
|
-
? spliceMarkerRegions(existingContent, p.content)
|
|
229
|
-
: p.content;
|
|
230
|
-
if (patched === existingContent) {
|
|
231
|
-
// No-op: regions already match.
|
|
232
|
-
next[p.relativePath] = hashContent(patched);
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
await writeFileEnsuringDir(p.absolutePath, patched);
|
|
236
|
-
next[p.relativePath] = hashContent(patched);
|
|
237
|
-
files.push({
|
|
238
|
-
absolutePath: p.absolutePath,
|
|
239
|
-
relativePath: p.relativePath,
|
|
240
|
-
});
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
// No markers — hash-protected overwrite.
|
|
244
|
-
const stored = previous[p.relativePath];
|
|
245
|
-
const pristine = stored !== undefined && stored === existing;
|
|
246
|
-
if (!pristine && !force) {
|
|
247
|
-
// User edited a managed file. Leave it alone.
|
|
248
|
-
warn(`skipped ${p.relativePath} — modified since last generation. Use --force to overwrite.`);
|
|
249
|
-
skipped.push({
|
|
250
|
-
absolutePath: p.absolutePath,
|
|
251
|
-
relativePath: p.relativePath,
|
|
252
|
-
});
|
|
253
|
-
// Preserve the previous hash so the file stays on our ledger.
|
|
254
|
-
if (stored !== undefined)
|
|
255
|
-
next[p.relativePath] = stored;
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
if (existing === hashContent(p.content)) {
|
|
259
|
-
// Already up to date.
|
|
260
|
-
next[p.relativePath] = existing;
|
|
261
|
-
continue;
|
|
262
|
-
}
|
|
263
|
-
await writeFileEnsuringDir(p.absolutePath, p.content);
|
|
264
|
-
next[p.relativePath] = hashContent(p.content);
|
|
265
|
-
files.push({
|
|
266
|
-
absolutePath: p.absolutePath,
|
|
267
|
-
relativePath: p.relativePath,
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
// Step 2: delete files that the new spec no longer emits, IF we still
|
|
271
|
-
// recognise their content (hash match). Otherwise warn and keep.
|
|
272
|
-
for (const [relPath, storedHash] of Object.entries(previous)) {
|
|
273
|
-
if (plannedByKey.has(relPath))
|
|
274
|
-
continue;
|
|
275
|
-
const abs = path.join(targetDir, relPath);
|
|
276
|
-
const onDisk = await hashFile(abs);
|
|
277
|
-
if (onDisk === null)
|
|
278
|
-
continue; // already gone
|
|
279
|
-
if (onDisk !== storedHash && !force) {
|
|
280
|
-
warn(`kept ${relPath} — modified since last generation; new spec no longer emits it.`);
|
|
281
|
-
next[relPath] = storedHash;
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
await fs.rm(abs, { force: true });
|
|
285
|
-
deleted.push({ absolutePath: abs, relativePath: relPath });
|
|
286
|
-
}
|
|
287
|
-
await writeProjectSpec(targetDir, spec);
|
|
288
|
-
await writeHashes(targetDir, next);
|
|
289
|
-
return {
|
|
290
|
-
mode: 'update',
|
|
291
|
-
files,
|
|
292
|
-
skipped,
|
|
293
|
-
deleted,
|
|
294
|
-
migrated,
|
|
295
|
-
cliDir,
|
|
296
|
-
appDir,
|
|
297
|
-
};
|
|
298
11
|
}
|
|
@@ -4,4 +4,80 @@ 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
|
-
},
|
|
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
|
+
}]>>;
|
|
@@ -1,50 +1,33 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {
|
|
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
|
|
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
|
|
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
|
|
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
|
},
|