@happyvertical/smrt-cli 0.57.0 → 0.57.2
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/README.md +1 -1
- package/agents/cookbook-apply.md +19 -5
- package/dist/{AuditLogCollection-WDHL-_AF-BeF0-WOm.js → AuditLogCollection-WDHL-_AF-D_hrLrOn.js} +1 -1
- package/dist/{OidcIdentity-BUblgQLs-2SX7ODeV.js → OidcIdentity-BUblgQLs-IuNMIhQo.js} +2 -2
- package/dist/{OidcIdentityCollection-ClOyaHeF-T7hWKrdm.js → OidcIdentityCollection-ClOyaHeF-CuqXh-3X.js} +1 -1
- package/dist/{ProfileAssetCollection-CRMcjLJ--BG3sV1ZT.js → ProfileAssetCollection-CRMcjLJ--2KIsnsmv.js} +3 -3
- package/dist/{ProfileCollection-C4INKh7Y-C4r3lkdr.js → ProfileCollection-C4INKh7Y-YAMDqm4j.js} +17 -17
- package/dist/{ProfileLinkCollection-DFfZRsgv-ByRZpcLF.js → ProfileLinkCollection-DFfZRsgv-DIqttvfN.js} +2 -2
- package/dist/{ProfileMetadataCollection-BIYKy4Y3-CfMdP5nK.js → ProfileMetadataCollection-BIYKy4Y3-Bdd-IgcJ.js} +1 -1
- package/dist/{ProfileMetafieldCollection-Buz7gzag-C4AXpyhm.js → ProfileMetafieldCollection-Buz7gzag-DI1MBIU1.js} +1 -1
- package/dist/{ProfileRelationshipCollection-C4g_QLI4-BvSiqB4J.js → ProfileRelationshipCollection-C4g_QLI4-iAgf6Fs6.js} +1 -1
- package/dist/{ProfileTypeCollection-B7kwi1mU-BpRipEQ3.js → ProfileTypeCollection-B7kwi1mU-D5hvWjoz.js} +2 -2
- package/dist/{apply-BNDIdixP.js → apply-C7kqOLl6.js} +114 -15
- package/dist/commands/cookbook/apply.d.ts +54 -6
- package/dist/commands/cookbook/apply.d.ts.map +1 -1
- package/dist/commands/cookbook/shared.d.ts.map +1 -1
- package/dist/commands/cookbook.d.ts.map +1 -1
- package/dist/commands/kitchen/apply.d.ts.map +1 -1
- package/dist/{commands-D2y3p_Bn.js → commands-C1vFtitF.js} +5 -5
- package/dist/dist-C1lMm9x_.js +21 -0
- package/dist/{dist-DAKDqxeH.js → dist-CRW60XkI.js} +4 -4
- package/dist/{dist-DEpgvg2W.js → dist-DDj_dW2s.js} +16 -16
- package/dist/{dist-DsVQcZ6G.js → dist-DJVDHkyS.js} +2 -2
- package/dist/{dist-D3wV_qqp.js → dist-DZJVt05S.js} +3 -3
- package/dist/index.js +11 -11
- package/dist/{oidcProvisioningPrimitives-DNP9EZlU-C9hYFUey.js → oidcProvisioningPrimitives-DNP9EZlU-DZ9CeZNd.js} +3 -3
- package/dist/{resolveIdentity-CkyqvctR-DdiQlufB.js → resolveIdentity-CkyqvctR-BzWkMn3m.js} +14 -14
- package/dist/{server-D2wRPnk0.js → server-CVEdVgJg.js} +1 -1
- package/package.json +10 -10
- package/dist/dist-Cz0fd3jS.js +0 -21
package/README.md
CHANGED
|
@@ -199,7 +199,7 @@ knowledge index; documentation snapshots use lightweight package discovery.
|
|
|
199
199
|
| `smrt export` | Export data in various formats |
|
|
200
200
|
| `smrt init` | Initialize s-m-r-t in an existing SvelteKit project |
|
|
201
201
|
| `smrt cookbook validate <file\|url>` | Check a cookbook against cookbook/v1 and the recipe manifests |
|
|
202
|
-
| `smrt cookbook apply <file\|url> [dir]` | Create a project from a cookbook and the smrt-start template (`--into`, `--template`, `--dry-run`, `--no-install`) |
|
|
202
|
+
| `smrt cookbook apply <file\|url> [dir]` | Create a project from a cookbook and the smrt-start template, its smrt packages pinned to this CLI's release (`--into`, `--template`, `--dry-run`, `--no-install`) |
|
|
203
203
|
| `smrt kitchen [dir]` | Serve the planner on localhost, chat to a cookbook, **Send to kitchen** applies it into `dir` (`--planner`, `--template`, `--no-open`, `--no-install`) |
|
|
204
204
|
| `smrt kitchen apply <url\|file> [dir]` | `cookbook apply` that also takes a plan URL |
|
|
205
205
|
|
package/agents/cookbook-apply.md
CHANGED
|
@@ -44,13 +44,27 @@ object that is not in its package's manifest, or a policy field the object lacks
|
|
|
44
44
|
`git archive HEAD` would drop. A non-git directory is copied whole minus `.git`/`node_modules`.
|
|
45
45
|
`package.json` `name` becomes the slug of `cookbook.name` when set, else of the target directory's
|
|
46
46
|
basename (never the template's name: the runtime derives the app identity, hence the OS data
|
|
47
|
-
directory, from it)
|
|
47
|
+
directory, from it), under the template's npm scope, else `@smrt-app` (`scopedProjectName`): SMRT
|
|
48
|
+
refuses to scan an unscoped project, so a template with its own models needs one (#4061).
|
|
48
49
|
- **Existing project**: `--into [dir]`, or re-running on a directory that already holds `smrt.cookbook.json`.
|
|
49
50
|
- **Writes**: missing packages (from the recipes, features and policies) into `dependencies`,
|
|
50
|
-
sorted; `smrt.cookbook.json` (the validated, normalized cookbook)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
sorted; `smrt.cookbook.json` (the validated, normalized cookbook); for a new project, the smrt pin
|
|
52
|
+
below. Nothing else. No sample data.
|
|
53
|
+
- **Versions**: the cookbook carries none (epic #3747). smrt releases in lockstep, so a **new project**
|
|
54
|
+
runs this CLI's release, not the template's (#4055; the default template pinned the 0.55 line that
|
|
55
|
+
GHSA-gq3p-p48q-9q54 covers): every `@happyvertical/smrt-*` registry range in the template's
|
|
56
|
+
`dependencies`/`devDependencies`/`optionalDependencies`, and every package a recipe adds, is set to
|
|
57
|
+
exactly the CLI's version (`cliVersion()` in `cookbook/shared.ts`). Non-smrt dependencies, peer ranges and
|
|
58
|
+
protocol/path specs (`workspace:`, `link:`, `file:`, `npm:` aliases, git) are left alone. When anything
|
|
59
|
+
was repinned, the template's lockfile (`pnpm-lock.yaml`, `package-lock.json`, `npm-shrinkwrap.json`,
|
|
60
|
+
`yarn.lock`, `bun.lock[b]`) is dropped so neither this install nor a later frozen one restores the old
|
|
61
|
+
versions; the package manager is still chosen from it. A CLI whose version is not a plain `x.y.z`
|
|
62
|
+
release (a prerelease, or `0.0.0` from an unresolved dev build) keeps the template's ranges and lockfile
|
|
63
|
+
and prints a warning (`warnings[]` in `--json`). The plan reports `smrtVersion`, `repinnedDependencies`
|
|
64
|
+
and `removedLockfiles`.
|
|
65
|
+
An **existing project** (`--into`, re-apply) is never repinned: a new dependency takes the range the
|
|
66
|
+
project already uses for `@happyvertical/smrt-core`, else the CLI's version (exact for a release).
|
|
67
|
+
Already-declared packages are never changed there. Removing a recipe does not remove its package.
|
|
54
68
|
- **Idempotent**: re-applying leaves an identical project untouched; an edited cookbook updates the
|
|
55
69
|
config file and adds packages without rewriting anything else.
|
|
56
70
|
- `--dry-run` prints the plan (no writes; a remote template is still fetched to a temp dir).
|
package/dist/{AuditLogCollection-WDHL-_AF-BeF0-WOm.js → AuditLogCollection-WDHL-_AF-D_hrLrOn.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as tenantId, r as TenantScoped } from "./dist-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
4
|
import { SmrtCollection, SmrtObject, field, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
5
5
|
//#region ../profiles/dist/chunks/AuditLogCollection-WDHL-_AF.js
|
|
@@ -42,7 +42,7 @@ var OidcIdentity = class extends SmrtObject {
|
|
|
42
42
|
* Find identity by issuer and subject
|
|
43
43
|
*/
|
|
44
44
|
static async findBySubject(issuer, subject, options = {}) {
|
|
45
|
-
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-
|
|
45
|
+
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CuqXh-3X.js").then((n) => n.r).then((n) => n.r);
|
|
46
46
|
return await (await OidcIdentityCollection.create(options)).findBySubject(issuer, subject);
|
|
47
47
|
}
|
|
48
48
|
/** Build the collision-free natural key for one OIDC issuer subject. */
|
|
@@ -65,7 +65,7 @@ var OidcIdentity = class extends SmrtObject {
|
|
|
65
65
|
static async findOrCreate(profile, oidcData, options = {}) {
|
|
66
66
|
const profileId = profile.id;
|
|
67
67
|
if (typeof profileId !== "string" || !profileId) throw new Error("OidcIdentity.findOrCreate() requires a saved Profile.");
|
|
68
|
-
const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-CkyqvctR-
|
|
68
|
+
const { reuseExistingOidcIdentityForProfile } = await import("./resolveIdentity-CkyqvctR-BzWkMn3m.js").then((n) => n.i).then((n) => n.i);
|
|
69
69
|
const profileOptions = profile.options ?? {};
|
|
70
70
|
return (await reuseExistingOidcIdentityForProfile(profileId, {
|
|
71
71
|
email: oidcData.email,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
3
|
-
import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-
|
|
3
|
+
import { t as OidcIdentity } from "./OidcIdentity-BUblgQLs-IuNMIhQo.js";
|
|
4
4
|
import { SmrtCollection } from "@happyvertical/smrt-core";
|
|
5
5
|
//#region ../profiles/dist/chunks/OidcIdentityCollection-ClOyaHeF.js
|
|
6
6
|
var OidcIdentityCollection_ClOyaHeF_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as tenantId, r as TenantScoped } from "./dist-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
|
-
import { a as getOwnedAssetsFromCollection, o as removeOwnedAssetFromCollection, t as addOwnedAssetFromCollection } from "./dist-
|
|
4
|
+
import { a as getOwnedAssetsFromCollection, o as removeOwnedAssetFromCollection, t as addOwnedAssetFromCollection } from "./dist-DZJVt05S.js";
|
|
5
5
|
import { SmrtJunction, SmrtObject, crossPackageRef, field, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
6
6
|
//#region ../profiles/dist/chunks/ProfileAssetCollection-CRMcjLJ-.js
|
|
7
7
|
var ProfileAssetCollection_CRMcjLJ__exports = /* @__PURE__ */ __exportAll({
|
|
@@ -84,7 +84,7 @@ var ProfileAssetCollection = class extends SmrtJunction {
|
|
|
84
84
|
profileCollectionPromise = null;
|
|
85
85
|
async getProfileCollection() {
|
|
86
86
|
if (!this.profileCollectionPromise) {
|
|
87
|
-
const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-
|
|
87
|
+
const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-YAMDqm4j.js").then((n) => n.o).then((n) => n.r);
|
|
88
88
|
this.profileCollectionPromise = ProfileCollection.create({ db: this.db });
|
|
89
89
|
}
|
|
90
90
|
return this.profileCollectionPromise;
|
package/dist/{ProfileCollection-C4INKh7Y-C4r3lkdr.js → ProfileCollection-C4INKh7Y-YAMDqm4j.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as queryGlobal, f as withSystemContext, i as tenantId, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, t as definePrompt, u as getTenantId } from "./dist-
|
|
2
|
+
import { a as queryGlobal, f as withSystemContext, i as tenantId, n as resolvePrompt, o as queryWithGlobals, r as TenantScoped, t as definePrompt, u as getTenantId } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
|
-
import { a as getOwnedAssetsFromCollection, i as assertValidOwnedAssetSortOrder, n as assertAssetLinkable, o as removeOwnedAssetFromCollection, r as assertValidOwnedAssetRelationship, s as resolveOwnedAssetsById, t as addOwnedAssetFromCollection } from "./dist-
|
|
4
|
+
import { a as getOwnedAssetsFromCollection, i as assertValidOwnedAssetSortOrder, n as assertAssetLinkable, o as removeOwnedAssetFromCollection, r as assertValidOwnedAssetRelationship, s as resolveOwnedAssetsById, t as addOwnedAssetFromCollection } from "./dist-DZJVt05S.js";
|
|
5
5
|
import { RuntimeError, SmrtCollection, SmrtObject, ValidationError, field, foreignKey, isAbortedTransactionError, oneToMany, smrt } from "@happyvertical/smrt-core";
|
|
6
6
|
import { BackfillTableUnavailableError, BackfillTracker } from "@happyvertical/smrt-core/migrations";
|
|
7
7
|
//#region ../profiles/dist/chunks/ProfileCollection-C4INKh7Y.js
|
|
@@ -435,7 +435,7 @@ var Profile = class extends SmrtObject {
|
|
|
435
435
|
async getTypeSlug() {
|
|
436
436
|
const tenantId2 = this.tenantId || getTenantId();
|
|
437
437
|
if (this.typeId && tenantId2) {
|
|
438
|
-
const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-
|
|
438
|
+
const { ProfileTypeCollection } = await import("./ProfileTypeCollection-B7kwi1mU-D5hvWjoz.js").then((n) => n.n).then((n) => n.n);
|
|
439
439
|
return (await (await ProfileTypeCollection.create(this.options)).getAvailableById(this.typeId, tenantId2))?.slug ?? "";
|
|
440
440
|
}
|
|
441
441
|
return (await this.loadRelated("typeId"))?.slug || "";
|
|
@@ -458,8 +458,8 @@ var Profile = class extends SmrtObject {
|
|
|
458
458
|
* @param value - The value to set
|
|
459
459
|
*/
|
|
460
460
|
async addMetadata(metafieldSlug, value) {
|
|
461
|
-
const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-
|
|
462
|
-
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-
|
|
461
|
+
const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-DI1MBIU1.js").then((n) => n.r).then((n) => n.n);
|
|
462
|
+
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-Bdd-IgcJ.js").then((n) => n.r).then((n) => n.n);
|
|
463
463
|
const metafield = await this.resolveMetafield(await ProfileMetafieldCollection.create(this.options), metafieldSlug);
|
|
464
464
|
if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
|
|
465
465
|
await metafield.validateValue(value);
|
|
@@ -492,7 +492,7 @@ var Profile = class extends SmrtObject {
|
|
|
492
492
|
* @returns Object with metafield slugs as keys
|
|
493
493
|
*/
|
|
494
494
|
async getMetadata() {
|
|
495
|
-
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-
|
|
495
|
+
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-Bdd-IgcJ.js").then((n) => n.r).then((n) => n.n);
|
|
496
496
|
return await (await ProfileMetadataCollection.create(this.options)).getMetadataObject(this.id);
|
|
497
497
|
}
|
|
498
498
|
/**
|
|
@@ -509,8 +509,8 @@ var Profile = class extends SmrtObject {
|
|
|
509
509
|
* @param metafieldSlug - The slug of the metafield to remove
|
|
510
510
|
*/
|
|
511
511
|
async removeMetadata(metafieldSlug) {
|
|
512
|
-
const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-
|
|
513
|
-
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-
|
|
512
|
+
const { ProfileMetafieldCollection } = await import("./ProfileMetafieldCollection-Buz7gzag-DI1MBIU1.js").then((n) => n.r).then((n) => n.n);
|
|
513
|
+
const { ProfileMetadataCollection } = await import("./ProfileMetadataCollection-BIYKy4Y3-Bdd-IgcJ.js").then((n) => n.r).then((n) => n.n);
|
|
514
514
|
const metafield = await this.resolveMetafield(await ProfileMetafieldCollection.create(this.options), metafieldSlug);
|
|
515
515
|
if (!metafield) throw new Error(`Metafield '${metafieldSlug}' not found`);
|
|
516
516
|
const existing = await (await ProfileMetadataCollection.create(this.options)).list({
|
|
@@ -535,7 +535,7 @@ var Profile = class extends SmrtObject {
|
|
|
535
535
|
return candidates.find((candidate) => ownerTenantId && candidate.tenantId === ownerTenantId) ?? candidates.find((candidate) => !candidate.tenantId) ?? null;
|
|
536
536
|
}
|
|
537
537
|
async getProfileLinkCollection() {
|
|
538
|
-
const { ProfileLinkCollection } = await import("./ProfileLinkCollection-DFfZRsgv-
|
|
538
|
+
const { ProfileLinkCollection } = await import("./ProfileLinkCollection-DFfZRsgv-DIqttvfN.js").then((n) => n.i).then((n) => n.r);
|
|
539
539
|
return ProfileLinkCollection.create({ db: this.db });
|
|
540
540
|
}
|
|
541
541
|
/** This profile's web links in display order. */
|
|
@@ -552,7 +552,7 @@ var Profile = class extends SmrtObject {
|
|
|
552
552
|
return (await this.getProfileLinkCollection()).replaceForProfile(this.id, links);
|
|
553
553
|
}
|
|
554
554
|
async getProfileAssetCollection() {
|
|
555
|
-
const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CRMcjLJ--
|
|
555
|
+
const { ProfileAssetCollection } = await import("./ProfileAssetCollection-CRMcjLJ--2KIsnsmv.js").then((n) => n.r).then((n) => n.n);
|
|
556
556
|
return ProfileAssetCollection.create({ db: this.db });
|
|
557
557
|
}
|
|
558
558
|
async getAssets(relationship) {
|
|
@@ -584,7 +584,7 @@ var Profile = class extends SmrtObject {
|
|
|
584
584
|
*/
|
|
585
585
|
async addRelationship(toProfile, relationshipSlug, contextProfile) {
|
|
586
586
|
const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js").then((n) => n.n).then((n) => n.n);
|
|
587
|
-
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-
|
|
587
|
+
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-iAgf6Fs6.js").then((n) => n.r).then((n) => n.n);
|
|
588
588
|
const { ProfileRelationshipType } = await import("./ProfileRelationshipType-U7IwF6Wf-DNavf24e.js").then((n) => n.n).then((n) => n.n);
|
|
589
589
|
const relationshipType = await (await ProfileRelationshipTypeCollection.create(this.options)).getBySlug(relationshipSlug);
|
|
590
590
|
if (!relationshipType) throw new Error(`Relationship type '${relationshipSlug}' not found`);
|
|
@@ -609,7 +609,7 @@ var Profile = class extends SmrtObject {
|
|
|
609
609
|
* @returns Array of ProfileRelationship instances
|
|
610
610
|
*/
|
|
611
611
|
async getRelationships(options) {
|
|
612
|
-
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-
|
|
612
|
+
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-iAgf6Fs6.js").then((n) => n.r).then((n) => n.n);
|
|
613
613
|
const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js").then((n) => n.n).then((n) => n.n);
|
|
614
614
|
const relationshipCollection = await ProfileRelationshipCollection.create(this.options);
|
|
615
615
|
const direction = options?.direction || "all";
|
|
@@ -654,7 +654,7 @@ var Profile = class extends SmrtObject {
|
|
|
654
654
|
*/
|
|
655
655
|
async removeRelationship(toProfile, relationshipSlug) {
|
|
656
656
|
const { ProfileRelationshipTypeCollection } = await import("./ProfileRelationshipTypeCollection-_n22WqTb-DiZUWvev.js").then((n) => n.n).then((n) => n.n);
|
|
657
|
-
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-
|
|
657
|
+
const { ProfileRelationshipCollection } = await import("./ProfileRelationshipCollection-C4g_QLI4-iAgf6Fs6.js").then((n) => n.r).then((n) => n.n);
|
|
658
658
|
const relationshipType = await (await ProfileRelationshipTypeCollection.create(this.options)).getBySlug(relationshipSlug);
|
|
659
659
|
if (!relationshipType) throw new Error(`Relationship type '${relationshipSlug}' not found`);
|
|
660
660
|
const relationshipCollection = await ProfileRelationshipCollection.create(this.options);
|
|
@@ -778,7 +778,7 @@ var Profile = class extends SmrtObject {
|
|
|
778
778
|
* @returns Array of OIDC identity records
|
|
779
779
|
*/
|
|
780
780
|
async getOidcIdentities() {
|
|
781
|
-
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-
|
|
781
|
+
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CuqXh-3X.js").then((n) => n.r).then((n) => n.r);
|
|
782
782
|
return await (await OidcIdentityCollection.create(this.options)).findByProfile(this.id);
|
|
783
783
|
}
|
|
784
784
|
/**
|
|
@@ -791,7 +791,7 @@ var Profile = class extends SmrtObject {
|
|
|
791
791
|
* type, but refuses to create or rebind authority.
|
|
792
792
|
*/
|
|
793
793
|
async linkOidcIdentity(oidcData) {
|
|
794
|
-
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-
|
|
794
|
+
const { OidcIdentityCollection } = await import("./OidcIdentityCollection-ClOyaHeF-CuqXh-3X.js").then((n) => n.r).then((n) => n.r);
|
|
795
795
|
return await (await OidcIdentityCollection.create(this.options)).linkToProfile(this, oidcData);
|
|
796
796
|
}
|
|
797
797
|
/**
|
|
@@ -820,7 +820,7 @@ var Profile = class extends SmrtObject {
|
|
|
820
820
|
* @returns Array of audit log entries
|
|
821
821
|
*/
|
|
822
822
|
async getAuditLogs(limit = 50) {
|
|
823
|
-
const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-
|
|
823
|
+
const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-D_hrLrOn.js").then((n) => n.r).then((n) => n.n);
|
|
824
824
|
return await (await AuditLogCollection.create(this.options)).getRecentActivity(this.id, limit);
|
|
825
825
|
}
|
|
826
826
|
/**
|
|
@@ -830,7 +830,7 @@ var Profile = class extends SmrtObject {
|
|
|
830
830
|
* @returns The created audit log entry
|
|
831
831
|
*/
|
|
832
832
|
async recordAction(options) {
|
|
833
|
-
const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-
|
|
833
|
+
const { AuditLogCollection } = await import("./AuditLogCollection-WDHL-_AF-D_hrLrOn.js").then((n) => n.r).then((n) => n.n);
|
|
834
834
|
return await (await AuditLogCollection.create(this.options)).record({
|
|
835
835
|
profile: this,
|
|
836
836
|
...options
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as tenantId, r as TenantScoped } from "./dist-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
4
|
import { SmrtCollection, SmrtObject, field, foreignKey, isEmbeddedDatabase, smrt, withEmbeddedWriteTransaction } from "@happyvertical/smrt-core";
|
|
5
5
|
//#region ../profiles/dist/chunks/ProfileLinkCollection-DFfZRsgv.js
|
|
@@ -203,7 +203,7 @@ var ProfileLinkCollection = class ProfileLinkCollection extends SmrtCollection {
|
|
|
203
203
|
/** The profile's tenant; throws when the profile is not visible here. */
|
|
204
204
|
async requireProfileTenant(profileId) {
|
|
205
205
|
if (!profileId) throw new Error("A profile link needs a profile");
|
|
206
|
-
const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-
|
|
206
|
+
const { ProfileCollection } = await import("./ProfileCollection-C4INKh7Y-YAMDqm4j.js").then((n) => n.o).then((n) => n.r);
|
|
207
207
|
const profile = await (await ProfileCollection.create({ db: this.db })).get({ id: profileId });
|
|
208
208
|
if (!profile) throw new Error(`Profile '${profileId}' not found`);
|
|
209
209
|
return profile.tenantId ?? null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as tenantId, r as TenantScoped } from "./dist-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
4
|
import { SmrtCollection, SmrtObject, field, foreignKey, smrt } from "@happyvertical/smrt-core";
|
|
5
5
|
//#region ../profiles/dist/chunks/ProfileMetadataCollection-BIYKy4Y3.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as tenantId, r as TenantScoped } from "./dist-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
4
|
import { SmrtCollection, SmrtObject, field, smrt } from "@happyvertical/smrt-core";
|
|
5
5
|
//#region ../profiles/dist/chunks/ProfileMetafieldCollection-Buz7gzag.js
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as tenantId, r as TenantScoped } from "./dist-
|
|
2
|
+
import { i as tenantId, r as TenantScoped } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
4
|
import { SmrtCollection, SmrtObject, foreignKey, oneToMany, smrt } from "@happyvertical/smrt-core";
|
|
5
5
|
//#region ../profiles/dist/chunks/ProfileRelationshipCollection-C4g_QLI4.js
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { c as withTenantGlobalRead, d as isSystemContext } from "./dist-
|
|
2
|
+
import { c as withTenantGlobalRead, d as isSystemContext } from "./dist-DJVDHkyS.js";
|
|
3
3
|
import { n as __exportAll$1 } from "./NostrIdentity-AC8fAdxe-DKxKyu_a.js";
|
|
4
|
-
import { s as ProfileType } from "./ProfileCollection-C4INKh7Y-
|
|
4
|
+
import { s as ProfileType } from "./ProfileCollection-C4INKh7Y-YAMDqm4j.js";
|
|
5
5
|
import { SmrtCollection } from "@happyvertical/smrt-core";
|
|
6
6
|
//#region ../profiles/dist/chunks/ProfileTypeCollection-B7kwi1mU.js
|
|
7
7
|
var ProfileTypeCollection_B7kwi1mU_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -21,6 +21,22 @@ var DEP_SECTIONS = [
|
|
|
21
21
|
"peerDependencies",
|
|
22
22
|
"optionalDependencies"
|
|
23
23
|
];
|
|
24
|
+
/** Sections a new project's smrt packages are pinned in (peer ranges stay ranges). */
|
|
25
|
+
var PINNED_SECTIONS = [
|
|
26
|
+
"dependencies",
|
|
27
|
+
"devDependencies",
|
|
28
|
+
"optionalDependencies"
|
|
29
|
+
];
|
|
30
|
+
var SMRT_PACKAGE_PREFIX = "@happyvertical/smrt-";
|
|
31
|
+
/** Lockfiles a template may ship; they resolve the template's own pins. */
|
|
32
|
+
var LOCKFILES = [
|
|
33
|
+
"pnpm-lock.yaml",
|
|
34
|
+
"package-lock.json",
|
|
35
|
+
"npm-shrinkwrap.json",
|
|
36
|
+
"yarn.lock",
|
|
37
|
+
"bun.lock",
|
|
38
|
+
"bun.lockb"
|
|
39
|
+
];
|
|
24
40
|
var ApplyError = class extends Error {};
|
|
25
41
|
function detectIndent(text) {
|
|
26
42
|
return /^( +|\t)"/m.exec(text)?.[1] ?? 2;
|
|
@@ -45,21 +61,82 @@ function declaredRange(json, name) {
|
|
|
45
61
|
}
|
|
46
62
|
}
|
|
47
63
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
64
|
+
* `version` when it is a plain release (`x.y.z`) that the registry serves;
|
|
65
|
+
* undefined for a prerelease, build metadata, or the `0.0.0` an unresolved
|
|
66
|
+
* dev build reports.
|
|
67
|
+
*/
|
|
68
|
+
function releasedVersion(version) {
|
|
69
|
+
return /^\d+\.\d+\.\d+$/.test(version) && version !== "0.0.0" ? version : void 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Range for packages an existing project (`--into`) does not declare yet:
|
|
73
|
+
* the framework line the project already uses (smrt packages release as one
|
|
74
|
+
* fixed group), else this CLI's own version (exact when it is a release).
|
|
51
75
|
*/
|
|
52
76
|
function chooseRange(json, cliVersion) {
|
|
53
77
|
const core = declaredRange(json, "@happyvertical/smrt-core");
|
|
54
78
|
if (core?.startsWith("workspace:")) return "workspace:*";
|
|
55
79
|
if (core && /^[\^~]?\d/.test(core)) return core;
|
|
56
|
-
return `^${cliVersion}`;
|
|
80
|
+
return releasedVersion(cliVersion) ?? `^${cliVersion}`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A copy of `json` with every `@happyvertical/smrt-*` registry range in
|
|
84
|
+
* dependencies, devDependencies and optionalDependencies set to exactly
|
|
85
|
+
* `version`, plus what changed. A protocol or path spec (`workspace:`,
|
|
86
|
+
* `link:`, `file:`, `npm:` alias, git, URL) is a deliberate local choice
|
|
87
|
+
* and is kept, as is every non-smrt dependency.
|
|
88
|
+
*/
|
|
89
|
+
function pinSmrtDependencies(json, version) {
|
|
90
|
+
const next = { ...json };
|
|
91
|
+
const changes = {};
|
|
92
|
+
for (const section of PINNED_SECTIONS) {
|
|
93
|
+
const deps = json[section];
|
|
94
|
+
if (!deps || typeof deps !== "object") continue;
|
|
95
|
+
const pinned = { ...deps };
|
|
96
|
+
for (const [name, spec] of Object.entries(deps)) {
|
|
97
|
+
if (!name.startsWith(SMRT_PACKAGE_PREFIX)) continue;
|
|
98
|
+
if (typeof spec !== "string" || /[:/]/.test(spec)) continue;
|
|
99
|
+
if (spec === version) continue;
|
|
100
|
+
pinned[name] = version;
|
|
101
|
+
changes[name] = {
|
|
102
|
+
from: spec,
|
|
103
|
+
to: version
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
next[section] = pinned;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
json: next,
|
|
110
|
+
changes
|
|
111
|
+
};
|
|
57
112
|
}
|
|
58
113
|
var slug = (value) => value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
59
114
|
/** A valid unscoped npm package name from free text, or undefined when nothing usable remains. */
|
|
60
115
|
function npmNameFromText(value) {
|
|
61
116
|
return slug(value).slice(0, 214).replace(/-+$/, "") || void 0;
|
|
62
117
|
}
|
|
118
|
+
/** The scope a new project's name takes when its template's name has none. */
|
|
119
|
+
var DEFAULT_PROJECT_SCOPE = "@smrt-app";
|
|
120
|
+
/**
|
|
121
|
+
* A new project's package name: the slug under the template's npm scope (else
|
|
122
|
+
* `@smrt-app`). SMRT qualifies class names as `@scope/package:ClassName` and
|
|
123
|
+
* refuses to scan a project with an unscoped name, so an unscoped name would
|
|
124
|
+
* leave any template that declares its own models unbuildable (#4061). A
|
|
125
|
+
* slug that would reproduce the template's name gets a `-project` suffix.
|
|
126
|
+
*/
|
|
127
|
+
function scopedProjectName(slugName, templateName) {
|
|
128
|
+
const scope = /^@[a-z0-9][a-z0-9._~-]*\//.exec(templateName ?? "")?.[0];
|
|
129
|
+
const prefix = scope ? scope.slice(0, -1) : DEFAULT_PROJECT_SCOPE;
|
|
130
|
+
const fit = (suffix) => {
|
|
131
|
+
const scopeOf = (candidate) => 214 - candidate.length - 1 - suffix.length >= 1 ? candidate : DEFAULT_PROJECT_SCOPE;
|
|
132
|
+
const chosen = scopeOf(prefix);
|
|
133
|
+
const room = 214 - chosen.length - 1 - suffix.length;
|
|
134
|
+
return `${chosen}/${slugName.slice(0, room).replace(/-+$/, "") || "app"}${suffix}`;
|
|
135
|
+
};
|
|
136
|
+
let name = fit("");
|
|
137
|
+
for (let n = 1; name === templateName; n += 1) name = fit(n === 1 ? "-project" : `-project-${n}`);
|
|
138
|
+
return name;
|
|
139
|
+
}
|
|
63
140
|
/** Parse `github:owner/repo#ref`, a git URL, or a local path. */
|
|
64
141
|
function parseTemplateSpec(spec) {
|
|
65
142
|
const [head, ref] = (() => {
|
|
@@ -185,13 +262,15 @@ function isEmptyDir(dir) {
|
|
|
185
262
|
function renderJson(value, indent = 2) {
|
|
186
263
|
return `${JSON.stringify(value, null, indent)}\n`;
|
|
187
264
|
}
|
|
188
|
-
function
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
265
|
+
function packageManagerFrom(has) {
|
|
266
|
+
if (has("yarn.lock")) return "yarn";
|
|
267
|
+
if (has("package-lock.json")) return "npm";
|
|
191
268
|
return "pnpm";
|
|
192
269
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
270
|
+
function packageManager(dir) {
|
|
271
|
+
return packageManagerFrom((file) => existsSync(join(dir, file)));
|
|
272
|
+
}
|
|
273
|
+
function nextSteps(dir, json, installed, cwd, pm = packageManager(dir)) {
|
|
195
274
|
const run = pm === "npm" ? "npm run" : pm;
|
|
196
275
|
const scripts = json.scripts ?? {};
|
|
197
276
|
const steps = [];
|
|
@@ -254,7 +333,18 @@ function applyCookbook(options) {
|
|
|
254
333
|
template = acquireTemplate(spec);
|
|
255
334
|
({json: baseJson, raw: baseRaw} = readPackageJson(template.root));
|
|
256
335
|
} else ({json: baseJson, raw: baseRaw} = readPackageJson(targetDir));
|
|
257
|
-
const
|
|
336
|
+
const warnings = [];
|
|
337
|
+
const smrtVersion = mode === "new" ? releasedVersion(options.cliVersion) : void 0;
|
|
338
|
+
if (mode === "new" && !smrtVersion) warnings.push(`this CLI's version (${options.cliVersion}) is not a published release, so the project keeps the template's @happyvertical/smrt-* ranges; pin them to a released smrt version before relying on the app`);
|
|
339
|
+
let repinnedDependencies = {};
|
|
340
|
+
if (smrtVersion) ({json: baseJson, changes: repinnedDependencies} = pinSmrtDependencies(baseJson, smrtVersion));
|
|
341
|
+
const copied = (file) => {
|
|
342
|
+
const { root, files } = template;
|
|
343
|
+
return files ? files.includes(file) : existsSync(join(root, file));
|
|
344
|
+
};
|
|
345
|
+
const removedLockfiles = mode === "new" && Object.keys(repinnedDependencies).length > 0 ? LOCKFILES.filter(copied) : [];
|
|
346
|
+
const pm = mode === "new" ? packageManagerFrom(copied) : packageManager(targetDir);
|
|
347
|
+
const range = smrtVersion ?? chooseRange(baseJson, options.cliVersion);
|
|
258
348
|
const addDependencies = {};
|
|
259
349
|
const keptDependencies = {};
|
|
260
350
|
for (const name of options.packages) {
|
|
@@ -264,7 +354,7 @@ function applyCookbook(options) {
|
|
|
264
354
|
}
|
|
265
355
|
const configFile = join(targetDir, COOKBOOK_CONFIG_FILE);
|
|
266
356
|
const config = mode === "update" && existsSync(configFile) ? readFileSync(configFile, "utf-8") === configText ? "unchanged" : "update" : "create";
|
|
267
|
-
const projectName = mode === "new" ? npmNameFromText(options.cookbook.name ?? "") ?? npmNameFromText(basename(targetDir)) ?? "smrt-app" : void 0;
|
|
357
|
+
const projectName = mode === "new" ? scopedProjectName(npmNameFromText(options.cookbook.name ?? "") ?? npmNameFromText(basename(targetDir)) ?? "smrt-app", typeof baseJson.name === "string" ? baseJson.name : void 0) : void 0;
|
|
268
358
|
const plan = {
|
|
269
359
|
mode,
|
|
270
360
|
targetDir,
|
|
@@ -275,6 +365,9 @@ function applyCookbook(options) {
|
|
|
275
365
|
projectName,
|
|
276
366
|
addDependencies,
|
|
277
367
|
keptDependencies,
|
|
368
|
+
smrtVersion,
|
|
369
|
+
repinnedDependencies,
|
|
370
|
+
removedLockfiles,
|
|
278
371
|
config
|
|
279
372
|
};
|
|
280
373
|
const nextJson = { ...baseJson };
|
|
@@ -293,13 +386,15 @@ function applyCookbook(options) {
|
|
|
293
386
|
dryRun: true,
|
|
294
387
|
written: [],
|
|
295
388
|
installed: false,
|
|
296
|
-
nextSteps: nextSteps(targetDir, nextJson, false, cwd)
|
|
389
|
+
nextSteps: nextSteps(targetDir, nextJson, false, cwd, pm),
|
|
390
|
+
warnings
|
|
297
391
|
};
|
|
298
392
|
const written = [];
|
|
299
393
|
if (mode === "new") {
|
|
300
394
|
mkdirSync(targetDir, { recursive: true });
|
|
301
395
|
copyTemplate(template, targetDir);
|
|
302
396
|
written.push(`${targetDir} (from template)`);
|
|
397
|
+
for (const file of removedLockfiles) rmSync(join(targetDir, file), { force: true });
|
|
303
398
|
}
|
|
304
399
|
if (mode === "new" || Object.keys(addDependencies).length > 0 || Boolean(projectName)) {
|
|
305
400
|
const file = join(targetDir, "package.json");
|
|
@@ -315,7 +410,6 @@ function applyCookbook(options) {
|
|
|
315
410
|
}
|
|
316
411
|
let installed = false;
|
|
317
412
|
if (wantInstall) {
|
|
318
|
-
const pm = packageManager(targetDir);
|
|
319
413
|
if (spawnSync(pm, ["install"], {
|
|
320
414
|
cwd: targetDir,
|
|
321
415
|
stdio: options.installOutput === "stderr" ? [
|
|
@@ -331,7 +425,8 @@ function applyCookbook(options) {
|
|
|
331
425
|
dryRun: false,
|
|
332
426
|
written,
|
|
333
427
|
installed,
|
|
334
|
-
nextSteps: nextSteps(targetDir, nextJson, installed, cwd)
|
|
428
|
+
nextSteps: nextSteps(targetDir, nextJson, installed, cwd, pm),
|
|
429
|
+
warnings
|
|
335
430
|
};
|
|
336
431
|
} finally {
|
|
337
432
|
template?.cleanup();
|
|
@@ -861,11 +956,14 @@ async function validateCookbookSource(text, options) {
|
|
|
861
956
|
}
|
|
862
957
|
/** Print what an apply did (or, for a dry run, would do) and the next steps. */
|
|
863
958
|
function printApplyResult(result, warnings, log = console.log, warn = console.warn) {
|
|
864
|
-
for (const warning of warnings) warn(`warning: ${warning}`);
|
|
959
|
+
for (const warning of [...warnings, ...result.warnings]) warn(`warning: ${warning}`);
|
|
865
960
|
const { plan } = result;
|
|
866
961
|
log(`${result.dryRun ? "Plan (dry run)" : "Applied"}: ${plan.mode === "new" ? "new project" : "update"} in ${plan.targetDir}`);
|
|
867
962
|
if (plan.template) log(` template: ${plan.template.spec}${plan.template.revision ? ` @ ${plan.template.revision}` : ""}`);
|
|
868
963
|
if (plan.projectName) log(` project name: ${plan.projectName}`);
|
|
964
|
+
if (plan.smrtVersion) log(` smrt packages pinned to ${plan.smrtVersion} (this CLI's release)`);
|
|
965
|
+
for (const [name, { from, to }] of Object.entries(plan.repinnedDependencies)) log(` ~ ${name}@${to} (template had ${from})`);
|
|
966
|
+
for (const file of plan.removedLockfiles) log(` - ${file} (resolved the template's pins; the install re-resolves)`);
|
|
869
967
|
for (const [name, range] of Object.entries(plan.addDependencies)) log(` + ${name}@${range}`);
|
|
870
968
|
for (const [name, range] of Object.entries(plan.keptDependencies)) log(` = ${name}@${range} (already declared)`);
|
|
871
969
|
log(` smrt.cookbook.json: ${plan.config}`);
|
|
@@ -916,6 +1014,7 @@ function createCookbookApplier(options) {
|
|
|
916
1014
|
dryRun: options.dryRun,
|
|
917
1015
|
cliVersion: cliVersion()
|
|
918
1016
|
});
|
|
1017
|
+
for (const warning of result.warnings) log(`warning: ${warning}`);
|
|
919
1018
|
return {
|
|
920
1019
|
ok: true,
|
|
921
1020
|
status: 200,
|
|
@@ -28,7 +28,11 @@ export interface ApplyOptions {
|
|
|
28
28
|
* stdio server). Stdin is never shared with the install in `stderr` mode.
|
|
29
29
|
*/
|
|
30
30
|
installOutput?: 'inherit' | 'stderr';
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Version of this CLI. smrt releases in lockstep, so a new project's
|
|
33
|
+
* `@happyvertical/smrt-*` packages are pinned to exactly this version when
|
|
34
|
+
* it is a plain release; it is also the last-resort range for `--into`.
|
|
35
|
+
*/
|
|
32
36
|
cliVersion: string;
|
|
33
37
|
cwd?: string;
|
|
34
38
|
}
|
|
@@ -42,8 +46,20 @@ export interface ApplyPlan {
|
|
|
42
46
|
projectName?: string;
|
|
43
47
|
/** Dependencies added to package.json. */
|
|
44
48
|
addDependencies: Record<string, string>;
|
|
45
|
-
/** Needed packages already declared (left
|
|
49
|
+
/** Needed packages already declared (left as they are, apart from the pin below). */
|
|
46
50
|
keptDependencies: Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* The exact version a new project's `@happyvertical/smrt-*` packages are
|
|
53
|
+
* pinned to (this CLI's), or undefined when they keep their ranges.
|
|
54
|
+
*/
|
|
55
|
+
smrtVersion?: string;
|
|
56
|
+
/** Template smrt dependencies whose range the pin replaced. */
|
|
57
|
+
repinnedDependencies: Record<string, {
|
|
58
|
+
from: string;
|
|
59
|
+
to: string;
|
|
60
|
+
}>;
|
|
61
|
+
/** Template lockfiles dropped because they resolve the replaced pins. */
|
|
62
|
+
removedLockfiles: string[];
|
|
47
63
|
config: 'create' | 'update' | 'unchanged';
|
|
48
64
|
}
|
|
49
65
|
export interface ApplyResult {
|
|
@@ -52,17 +68,49 @@ export interface ApplyResult {
|
|
|
52
68
|
written: string[];
|
|
53
69
|
installed: boolean;
|
|
54
70
|
nextSteps: string[];
|
|
71
|
+
/** Things the user should know about the result (e.g. an unpinned dev build). */
|
|
72
|
+
warnings: string[];
|
|
55
73
|
}
|
|
56
74
|
export declare class ApplyError extends Error {
|
|
57
75
|
}
|
|
58
76
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
77
|
+
* `version` when it is a plain release (`x.y.z`) that the registry serves;
|
|
78
|
+
* undefined for a prerelease, build metadata, or the `0.0.0` an unresolved
|
|
79
|
+
* dev build reports.
|
|
80
|
+
*/
|
|
81
|
+
export declare function releasedVersion(version: string): string | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Range for packages an existing project (`--into`) does not declare yet:
|
|
84
|
+
* the framework line the project already uses (smrt packages release as one
|
|
85
|
+
* fixed group), else this CLI's own version (exact when it is a release).
|
|
62
86
|
*/
|
|
63
87
|
export declare function chooseRange(json: PackageJson, cliVersion: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* A copy of `json` with every `@happyvertical/smrt-*` registry range in
|
|
90
|
+
* dependencies, devDependencies and optionalDependencies set to exactly
|
|
91
|
+
* `version`, plus what changed. A protocol or path spec (`workspace:`,
|
|
92
|
+
* `link:`, `file:`, `npm:` alias, git, URL) is a deliberate local choice
|
|
93
|
+
* and is kept, as is every non-smrt dependency.
|
|
94
|
+
*/
|
|
95
|
+
export declare function pinSmrtDependencies(json: PackageJson, version: string): {
|
|
96
|
+
json: PackageJson;
|
|
97
|
+
changes: Record<string, {
|
|
98
|
+
from: string;
|
|
99
|
+
to: string;
|
|
100
|
+
}>;
|
|
101
|
+
};
|
|
64
102
|
/** A valid unscoped npm package name from free text, or undefined when nothing usable remains. */
|
|
65
103
|
export declare function npmNameFromText(value: string): string | undefined;
|
|
104
|
+
/** The scope a new project's name takes when its template's name has none. */
|
|
105
|
+
export declare const DEFAULT_PROJECT_SCOPE = "@smrt-app";
|
|
106
|
+
/**
|
|
107
|
+
* A new project's package name: the slug under the template's npm scope (else
|
|
108
|
+
* `@smrt-app`). SMRT qualifies class names as `@scope/package:ClassName` and
|
|
109
|
+
* refuses to scan a project with an unscoped name, so an unscoped name would
|
|
110
|
+
* leave any template that declares its own models unbuildable (#4061). A
|
|
111
|
+
* slug that would reproduce the template's name gets a `-project` suffix.
|
|
112
|
+
*/
|
|
113
|
+
export declare function scopedProjectName(slugName: string, templateName: string | undefined): string;
|
|
66
114
|
/** Parse `github:owner/repo#ref`, a git URL, or a local path. */
|
|
67
115
|
export declare function parseTemplateSpec(spec: string): {
|
|
68
116
|
kind: 'local';
|
|
@@ -95,7 +143,7 @@ interface AcquiredTemplate {
|
|
|
95
143
|
export declare function listLocalTemplateFiles(dir: string): string[] | undefined;
|
|
96
144
|
/** Resolve a template to a directory: a local path as-is, a git source shallow-fetched. */
|
|
97
145
|
export declare function acquireTemplate(spec: string): AcquiredTemplate;
|
|
98
|
-
export declare function nextSteps(dir: string, json: PackageJson, installed: boolean, cwd: string): string[];
|
|
146
|
+
export declare function nextSteps(dir: string, json: PackageJson, installed: boolean, cwd: string, pm?: string): string[];
|
|
99
147
|
/** Plan and (unless dry-run) perform the apply. */
|
|
100
148
|
export declare function applyCookbook(options: ApplyOptions): ApplyResult;
|
|
101
149
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/commands/cookbook/apply.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAgBH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,eAAO,MAAM,oBAAoB,uB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