@powerhousedao/ph-clint-cli 0.1.0-dev.3 → 0.1.0-dev.5
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 +2 -4
- package/dist/codegen/builders/cli-package-json.js +30 -3
- package/dist/codegen/builders/cli-ts.js +2 -4
- package/dist/codegen/builders/config-ts.js +11 -15
- package/dist/codegen/builders/framework-gen-ts.js +1 -1
- package/dist/codegen/builders/readme-md.js +1 -1
- package/dist/commands/clint-project-init.js +2 -2
- package/dist/commands/clint-project-regen.js +2 -2
- package/dist/config.d.ts +3 -5
- package/dist/config.js +5 -7
- package/dist/framework.gen.js +1 -1
- package/package.json +4 -4
package/dist/cli.js
CHANGED
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
* Everything outside the markers is user-editable and preserved.
|
|
8
8
|
*/
|
|
9
9
|
import path from 'node:path';
|
|
10
|
-
import { fileURLToPath } from 'node:url';
|
|
11
10
|
import { defineCli, buildDefaultReactor } from '@powerhousedao/ph-clint';
|
|
12
|
-
import { CLI_NAME, CLI_VERSION } from './config.js';
|
|
11
|
+
import { CLI_NAME, CLI_VERSION, CLI_ROOT } from './config.js';
|
|
13
12
|
import { configSchema, secretsSchema } from './framework.js';
|
|
14
13
|
// @clint:begin imports
|
|
15
14
|
import { documentModels } from '@powerhousedao/ph-clint-app';
|
|
@@ -22,8 +21,7 @@ import { clintProject } from './services/clint-project.js';
|
|
|
22
21
|
import { specChangeTrigger } from './triggers/spec-change.js';
|
|
23
22
|
// @clint:end imports
|
|
24
23
|
// Connect (ph connect) must run inside the Reactor Package (ph-clint-app).
|
|
25
|
-
const
|
|
26
|
-
const appDir = path.resolve(__dirname, '../../ph-clint-app');
|
|
24
|
+
const appDir = path.resolve(CLI_ROOT, '../ph-clint-app');
|
|
27
25
|
export const cli = defineCli({
|
|
28
26
|
name: CLI_NAME,
|
|
29
27
|
version: CLI_VERSION,
|
|
@@ -5,8 +5,36 @@
|
|
|
5
5
|
* `{root}/{name}-cli/package.json`. Otherwise at `{root}/package.json`.
|
|
6
6
|
*/
|
|
7
7
|
import { getBinName, getPackageName, } from '../../spec/types.js';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { CLI_VERSION } from '../../config.js';
|
|
9
|
+
/**
|
|
10
|
+
* Derive a semver range from the running ph-clint-cli version that respects
|
|
11
|
+
* the dev / staging / production channel boundary. This is the version range
|
|
12
|
+
* emitted into *scaffolded* projects' package.json for @powerhousedao/ph-clint
|
|
13
|
+
* and @powerhousedao/ph-clint-dev dependencies.
|
|
14
|
+
*
|
|
15
|
+
* CLI_VERSION is the version of ph-clint-cli itself (read from its own
|
|
16
|
+
* package.json at startup). Since all framework packages share a lockstep
|
|
17
|
+
* version, this is also the correct base for the dependency range.
|
|
18
|
+
*
|
|
19
|
+
* Examples:
|
|
20
|
+
* "0.1.0" → "^0.1.0" (production — stable only)
|
|
21
|
+
* "0.1.0-staging.2" → "^0.1.0-staging.0" (staging + stable)
|
|
22
|
+
* "0.1.0-dev.4" → "^0.1.0-dev.0" (dev + staging + stable)
|
|
23
|
+
*
|
|
24
|
+
* This works because semver orders prereleases alphabetically:
|
|
25
|
+
* dev.N < staging.N < release. A caret range starting at dev.0 naturally
|
|
26
|
+
* upgrades through staging to production.
|
|
27
|
+
*/
|
|
28
|
+
function phClintRange(version) {
|
|
29
|
+
const match = /^(\d+\.\d+\.\d+)(?:-([a-z]+)\.\d+)?/.exec(version);
|
|
30
|
+
if (!match)
|
|
31
|
+
return `^${version}`;
|
|
32
|
+
const base = match[1];
|
|
33
|
+
const channel = match[2]; // "dev", "staging", or undefined
|
|
34
|
+
return channel ? `^${base}-${channel}.0` : `^${base}`;
|
|
35
|
+
}
|
|
36
|
+
/** Version range for @powerhousedao/ph-clint{,-dev} deps in scaffolded projects. */
|
|
37
|
+
const PH_CLINT_VERSION = phClintRange(CLI_VERSION);
|
|
10
38
|
const POWERHOUSE_VERSION = '6.0.0-dev.170';
|
|
11
39
|
export function buildCliPackageJson(spec) {
|
|
12
40
|
const { mastra, powerhouse } = spec.features;
|
|
@@ -43,7 +71,6 @@ export function buildCliPackageJson(spec) {
|
|
|
43
71
|
scripts['mastra:build'] = 'mastra build';
|
|
44
72
|
scripts['mastra:start'] = 'mastra start';
|
|
45
73
|
}
|
|
46
|
-
scripts['publish:npm'] = 'pnpm build && pnpm publish --no-git-checks';
|
|
47
74
|
const pkg = {
|
|
48
75
|
name: pkgName,
|
|
49
76
|
version: spec.version,
|
|
@@ -10,13 +10,12 @@ export function buildCliTs(spec) {
|
|
|
10
10
|
lines.push(' */');
|
|
11
11
|
if (powerhouse.enabled) {
|
|
12
12
|
lines.push(`import path from 'node:path';`);
|
|
13
|
-
lines.push(`import { fileURLToPath } from 'node:url';`);
|
|
14
13
|
lines.push(`import { defineCli, buildDefaultReactor } from '@powerhousedao/ph-clint';`);
|
|
15
14
|
}
|
|
16
15
|
else {
|
|
17
16
|
lines.push(`import { defineCli } from '@powerhousedao/ph-clint';`);
|
|
18
17
|
}
|
|
19
|
-
lines.push(`import { CLI_NAME, CLI_VERSION } from './config.js';`);
|
|
18
|
+
lines.push(`import { CLI_NAME, CLI_VERSION${powerhouse.enabled ? ', CLI_ROOT' : ''} } from './config.js';`);
|
|
20
19
|
lines.push(`import { configSchema, secretsSchema } from './framework.js';`);
|
|
21
20
|
lines.push('');
|
|
22
21
|
lines.push('// @clint:begin imports');
|
|
@@ -29,8 +28,7 @@ export function buildCliTs(spec) {
|
|
|
29
28
|
lines.push('// @clint:end imports');
|
|
30
29
|
lines.push('');
|
|
31
30
|
if (powerhouse.enabled) {
|
|
32
|
-
lines.push(`const
|
|
33
|
-
lines.push(`const appDir = path.resolve(__dirname, '../../${spec.name}-app');`);
|
|
31
|
+
lines.push(`const appDir = path.resolve(CLI_ROOT, '../${spec.name}-app');`);
|
|
34
32
|
lines.push('');
|
|
35
33
|
}
|
|
36
34
|
lines.push('export const cli = defineCli({');
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds `src/config.ts` — CLI identity constants (name, version, project
|
|
3
|
-
* root path). The Zod `configSchema` / `secretsSchema` are emitted by
|
|
4
|
-
* `buildFrameworkTs` into `src/framework.ts` (user-owned, init-only) so users
|
|
5
|
-
* can extend them without fighting the generator.
|
|
6
|
-
*/
|
|
7
|
-
import { getBinName, } from '../../spec/types.js';
|
|
8
1
|
export function buildConfigTs(spec) {
|
|
9
|
-
const
|
|
2
|
+
const hasCustomBin = !!spec.bin;
|
|
10
3
|
const lines = [];
|
|
11
|
-
lines.push(`import
|
|
12
|
-
lines.push(`import { fileURLToPath } from 'node:url';`);
|
|
4
|
+
lines.push(`import { readPackageInfo } from '@powerhousedao/ph-clint';`);
|
|
13
5
|
lines.push('');
|
|
14
|
-
lines.push('
|
|
15
|
-
lines.push(`export const CLI_NAME = '${cliName}';`);
|
|
16
|
-
lines.push(`export const CLI_VERSION = '${spec.version}';`);
|
|
6
|
+
lines.push('const pkg = readPackageInfo(import.meta.url);');
|
|
17
7
|
lines.push('');
|
|
18
|
-
lines.push('
|
|
19
|
-
|
|
8
|
+
lines.push('export const CLI_ROOT = pkg.root;');
|
|
9
|
+
if (hasCustomBin) {
|
|
10
|
+
lines.push(`export const CLI_NAME = '${spec.bin}';`);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
lines.push(`export const CLI_NAME = pkg.name.replace(/-cli$/, '');`);
|
|
14
|
+
}
|
|
15
|
+
lines.push('export const CLI_VERSION = pkg.version;');
|
|
20
16
|
return lines.join('\n') + '\n';
|
|
21
17
|
}
|
|
@@ -33,7 +33,7 @@ export function buildFrameworkGenTs(spec) {
|
|
|
33
33
|
lines.push('/**');
|
|
34
34
|
lines.push(' * THIS FILE IS GENERATED BY ph-clint-cli. DO NOT EDIT.');
|
|
35
35
|
lines.push(' *');
|
|
36
|
-
lines.push(' * Regenerated on every `ph-clint regen` and on every spec-change');
|
|
36
|
+
lines.push(' * Regenerated on every `ph-clint clint-project-regen` and on every spec-change');
|
|
37
37
|
lines.push(' * tick. Put custom bindings in `framework.ts`, not here — edits to');
|
|
38
38
|
lines.push(' * this file will be overwritten.');
|
|
39
39
|
lines.push(' */');
|
|
@@ -30,7 +30,7 @@ export function buildReadme(spec) {
|
|
|
30
30
|
lines.push('## Regenerate');
|
|
31
31
|
lines.push('');
|
|
32
32
|
lines.push('Toggle features or update metadata in `.ph/ph-clint-cli/project-spec.json`,');
|
|
33
|
-
lines.push('then re-run `ph-clint` to regenerate.');
|
|
33
|
+
lines.push('then re-run `ph-clint clint-project-regen` to regenerate.');
|
|
34
34
|
lines.push('');
|
|
35
35
|
if (powerhouse.enabled) {
|
|
36
36
|
lines.push('## Split layout');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `ph-clint init` — the project bootstrap wizard.
|
|
2
|
+
* `ph-clint clint-project-init` — the project bootstrap wizard.
|
|
3
3
|
*
|
|
4
4
|
* Behavior:
|
|
5
5
|
* 1. Resolve target dir (positional `dir`, defaults to cwd).
|
|
@@ -159,7 +159,7 @@ export const init = defineCommand({
|
|
|
159
159
|
next.push(' pnpm dev');
|
|
160
160
|
}
|
|
161
161
|
next.push('');
|
|
162
|
-
next.push('Edit the project spec and run `ph-clint regen` to regenerate.');
|
|
162
|
+
next.push('Edit the project spec and run `ph-clint clint-project-regen` to regenerate.');
|
|
163
163
|
return {
|
|
164
164
|
text: next.join('\n'),
|
|
165
165
|
data: { targetDir, spec, fileCount: result.files.length },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `ph-clint regen` — reconcile an existing project against its persisted
|
|
2
|
+
* `ph-clint clint-project-regen` — reconcile an existing project against its persisted
|
|
3
3
|
* spec. Equivalent to running the generator in update mode.
|
|
4
4
|
*
|
|
5
5
|
* Run inside a project directory (or pass `--dir`). If the spec has flipped
|
|
@@ -31,7 +31,7 @@ export const regen = defineCommand({
|
|
|
31
31
|
if (!spec) {
|
|
32
32
|
return {
|
|
33
33
|
text: `Error: no spec found at ${targetDir}/.ph/ph-clint-cli/project-spec.json.\n` +
|
|
34
|
-
'Run `ph-clint init` first to scaffold a new project.',
|
|
34
|
+
'Run `ph-clint clint-project-init` first to scaffold a new project.',
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
const warnings = [];
|
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const CLI_NAME
|
|
3
|
-
export declare const CLI_VERSION
|
|
4
|
-
/** Project root — resolved from this file's location. */
|
|
5
|
-
export declare const PROJECT_ROOT: string;
|
|
1
|
+
export declare const CLI_ROOT: string;
|
|
2
|
+
export declare const CLI_NAME: string;
|
|
3
|
+
export declare const CLI_VERSION: string;
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const CLI_NAME = '
|
|
5
|
-
export const CLI_VERSION =
|
|
6
|
-
/** Project root — resolved from this file's location. */
|
|
7
|
-
export const PROJECT_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
1
|
+
import { readPackageInfo } from '@powerhousedao/ph-clint';
|
|
2
|
+
const pkg = readPackageInfo(import.meta.url);
|
|
3
|
+
export const CLI_ROOT = pkg.root;
|
|
4
|
+
export const CLI_NAME = pkg.name.replace(/-cli$/, '');
|
|
5
|
+
export const CLI_VERSION = pkg.version;
|
package/dist/framework.gen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* THIS FILE IS GENERATED BY ph-clint-cli. DO NOT EDIT.
|
|
3
3
|
*
|
|
4
|
-
* Regenerated on every `ph-clint regen` and on every spec-change tick.
|
|
4
|
+
* Regenerated on every `ph-clint clint-project-regen` and on every spec-change tick.
|
|
5
5
|
* Put custom bindings in `framework.ts`, not here — edits to this file
|
|
6
6
|
* will be overwritten.
|
|
7
7
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/ph-clint-cli",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"mastra:start": "mastra start"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@powerhousedao/ph-clint": "^0.1.0-dev.
|
|
29
|
-
"@powerhousedao/ph-clint-app": "^0.1.0-dev.
|
|
28
|
+
"@powerhousedao/ph-clint": "^0.1.0-dev.5",
|
|
29
|
+
"@powerhousedao/ph-clint-app": "^0.1.0-dev.5",
|
|
30
30
|
"@mastra/core": "^1.22.0",
|
|
31
31
|
"@mastra/libsql": "^1.7.4",
|
|
32
32
|
"@mastra/memory": "^1.13.1",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@jest/globals": "^30.2.0",
|
|
49
49
|
"@types/node": "^25.5.2",
|
|
50
50
|
"jest": "^30.2.0",
|
|
51
|
-
"@powerhousedao/ph-clint-dev": "^0.1.0-dev.
|
|
51
|
+
"@powerhousedao/ph-clint-dev": "^0.1.0-dev.5",
|
|
52
52
|
"ts-jest": "^29.4.6",
|
|
53
53
|
"tsx": "^4.19.0",
|
|
54
54
|
"typescript": "^6.0.2"
|