@intelligo-dev/cli 1.0.0-beta.1 → 1.0.0-beta.14
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/NOTICE +6 -0
- package/README.md +102 -0
- package/dist/bin.js +122 -37
- package/dist/bin.js.map +1 -1
- package/dist/commands/add.d.ts +26 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +70 -4
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/create-flow.d.ts +37 -0
- package/dist/commands/create-flow.d.ts.map +1 -0
- package/dist/commands/create-flow.js +212 -0
- package/dist/commands/create-flow.js.map +1 -0
- package/dist/commands/create.d.ts +27 -6
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +53 -13
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/doctor.d.ts +14 -3
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +295 -37
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/migrate-check.d.ts +73 -1
- package/dist/commands/migrate-check.d.ts.map +1 -1
- package/dist/commands/migrate-check.js +130 -5
- package/dist/commands/migrate-check.js.map +1 -1
- package/dist/commands/migrate.d.ts +97 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +141 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/sync-messages.d.ts +37 -0
- package/dist/commands/sync-messages.d.ts.map +1 -0
- package/dist/commands/sync-messages.js +88 -0
- package/dist/commands/sync-messages.js.map +1 -0
- package/dist/commands/sync-scaffold.d.ts +36 -0
- package/dist/commands/sync-scaffold.d.ts.map +1 -0
- package/dist/commands/sync-scaffold.js +53 -0
- package/dist/commands/sync-scaffold.js.map +1 -0
- package/dist/commands/sync.d.ts +103 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +361 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/upgrade-check.d.ts +5 -5
- package/dist/commands/upgrade-check.d.ts.map +1 -1
- package/dist/commands/upgrade-check.js +22 -6
- package/dist/commands/upgrade-check.js.map +1 -1
- package/dist/env-files.d.ts +12 -0
- package/dist/env-files.d.ts.map +1 -0
- package/dist/env-files.js +29 -0
- package/dist/env-files.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +36 -15
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +32 -16
- package/dist/manifest.js.map +1 -1
- package/dist/migrations.d.ts +3 -6
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +3 -6
- package/dist/migrations.js.map +1 -1
- package/dist/model-catalogue.d.ts +14 -0
- package/dist/model-catalogue.d.ts.map +1 -0
- package/dist/model-catalogue.js +34 -0
- package/dist/model-catalogue.js.map +1 -0
- package/dist/module-exports.d.ts +63 -0
- package/dist/module-exports.d.ts.map +1 -0
- package/dist/module-exports.js +231 -0
- package/dist/module-exports.js.map +1 -0
- package/dist/registry-bundle.d.ts +43 -0
- package/dist/registry-bundle.d.ts.map +1 -0
- package/dist/registry-bundle.js +74 -0
- package/dist/registry-bundle.js.map +1 -0
- package/dist/registry-items.d.ts +84 -0
- package/dist/registry-items.d.ts.map +1 -0
- package/dist/registry-items.js +187 -0
- package/dist/registry-items.js.map +1 -0
- package/package.json +36 -10
- package/src/bin.ts +316 -0
- package/src/commands/add.ts +255 -0
- package/src/commands/create-flow.ts +284 -0
- package/src/commands/create.ts +149 -0
- package/src/commands/doctor.ts +487 -0
- package/src/commands/migrate-check.ts +298 -0
- package/src/commands/migrate.ts +228 -0
- package/src/commands/sync-messages.ts +114 -0
- package/src/commands/sync-scaffold.ts +83 -0
- package/src/commands/sync.ts +534 -0
- package/src/commands/upgrade-check.ts +160 -0
- package/src/env-files.ts +31 -0
- package/src/index.ts +39 -0
- package/src/manifest.ts +147 -0
- package/src/migrations-dir.ts +25 -0
- package/src/migrations.ts +133 -0
- package/src/model-catalogue.ts +35 -0
- package/src/module-exports.ts +266 -0
- package/src/registry-bundle.ts +103 -0
- package/src/registry-items.ts +237 -0
- package/templates/admin-page/admin-page.tsx.tpl +2 -3
- package/templates/app-scaffold/assistant-route.ts.tpl +2 -2
- package/templates/app-scaffold/auth-route.ts.tpl +10 -0
- package/templates/app-scaffold/components.json.tpl +6 -2
- package/templates/app-scaffold/db-schema.ts.tpl +29 -0
- package/templates/app-scaffold/drizzle-journal.json.tpl +5 -0
- package/templates/app-scaffold/drizzle.config.ts.tpl +45 -0
- package/templates/app-scaffold/env.example.tpl +65 -1
- package/templates/app-scaffold/globals.css.tpl +172 -281
- package/templates/app-scaffold/i18n-request.ts.tpl +25 -0
- package/templates/app-scaffold/instrumentation.ts.tpl +21 -0
- package/templates/app-scaffold/intelligo.ts.tpl +95 -41
- package/templates/app-scaffold/layout.tsx.tpl +18 -1
- package/templates/app-scaffold/lib-utils.ts.tpl +1 -6
- package/templates/app-scaffold/next.config.mjs.tpl +2 -0
- package/templates/app-scaffold/package.json.tpl +31 -17
- package/templates/app-scaffold/page.tsx.tpl +16 -0
- package/templates/app-scaffold/plans.ts.tpl +32 -13
- package/templates/app-scaffold/{middleware.ts.tpl → proxy.ts.tpl} +6 -0
- package/templates/app-scaffold/sonner.tsx.tpl +42 -20
- package/templates/app-scaffold/stripe-webhook-route.ts.tpl +24 -0
- package/templates/app-scaffold/theme-provider.tsx.tpl +6 -4
- package/templates/app-scaffold/tsconfig.json.tpl +20 -4
- package/templates/app-scaffold/use-mobile.ts.tpl +19 -0
- package/templates/app-scaffold/workspace-bootstrap.ts.tpl +30 -0
- package/templates/maintenance/maintenance-route.ts.tpl +119 -0
- package/templates/manifest.json +75 -17
- package/templates/registry/ai-agent-activity.json +23 -0
- package/templates/registry/ai-agent-progress.json +21 -0
- package/templates/registry/ai-approval-card.json +27 -0
- package/templates/registry/ai-artifact.json +22 -0
- package/templates/registry/ai-branch.json +21 -0
- package/templates/registry/ai-citations.json +24 -0
- package/templates/registry/ai-code-block.json +23 -0
- package/templates/registry/ai-composer-menu.json +19 -0
- package/templates/registry/ai-file-diff.json +25 -0
- package/templates/registry/ai-image-generation.json +23 -0
- package/templates/registry/ai-markdown.json +23 -0
- package/templates/registry/ai-message-bubble.json +23 -0
- package/templates/registry/ai-message-scroller.json +22 -0
- package/templates/registry/ai-message.json +21 -0
- package/templates/registry/ai-motion.json +19 -0
- package/templates/registry/ai-prompt-input.json +28 -0
- package/templates/registry/ai-reasoning-text.json +22 -0
- package/templates/registry/ai-reasoning.json +22 -0
- package/templates/registry/ai-shimmer-text.json +19 -0
- package/templates/registry/ai-sidebar.json +25 -0
- package/templates/registry/ai-speech-input.json +21 -0
- package/templates/registry/ai-streaming-response.json +24 -0
- package/templates/registry/ai-suggestion.json +19 -0
- package/templates/registry/ai-todo-list.json +22 -0
- package/templates/registry/ai-tool-approval.json +26 -0
- package/templates/registry/ai-tool-result.json +25 -0
- package/templates/registry/alert-dialog.json +23 -0
- package/templates/registry/animated-list.json +21 -0
- package/templates/registry/app-shell.json +93 -0
- package/templates/registry/artifacts.json +82 -0
- package/templates/registry/attachment.json +22 -0
- package/templates/registry/auth-email-verification.json +39 -0
- package/templates/registry/auth-login.json +72 -0
- package/templates/registry/auth-password-reset.json +53 -0
- package/templates/registry/auth-signup.json +41 -0
- package/templates/registry/billing-settings.json +60 -0
- package/templates/registry/button.json +22 -0
- package/templates/registry/chat-eve.json +19 -0
- package/templates/registry/chat-panel.json +30 -0
- package/templates/registry/chat-share.json +42 -0
- package/templates/registry/chat-widget.json +34 -0
- package/templates/registry/chat.json +326 -0
- package/templates/registry/checkbox.json +22 -0
- package/templates/registry/checkout.json +40 -0
- package/templates/registry/collapsible.json +19 -0
- package/templates/registry/command.json +23 -0
- package/templates/registry/copy-button.json +21 -0
- package/templates/registry/dashboard.json +69 -0
- package/templates/registry/dialog.json +24 -0
- package/templates/registry/document-viewer.json +22 -0
- package/templates/registry/dropdown-menu.json +23 -0
- package/templates/registry/expandable-tabs.json +22 -0
- package/templates/registry/feature-gating.json +73 -0
- package/templates/registry/file-upload.json +24 -0
- package/templates/registry/hold-action-button.json +22 -0
- package/templates/registry/input-group.json +23 -0
- package/templates/registry/input.json +19 -0
- package/templates/registry/intelligo.json +187 -0
- package/templates/registry/invitation-accept.json +64 -0
- package/templates/registry/language-switcher.json +29 -0
- package/templates/registry/morphing-modal.json +24 -0
- package/templates/registry/notification-stack.json +24 -0
- package/templates/registry/notifications.json +87 -0
- package/templates/registry/onboarding.json +83 -0
- package/templates/registry/otp-input.json +22 -0
- package/templates/registry/page-header.json +15 -0
- package/templates/registry/payment-poll.json +52 -0
- package/templates/registry/popover-morph.json +22 -0
- package/templates/registry/popover.json +22 -0
- package/templates/registry/pricing.json +111 -0
- package/templates/registry/privacy-settings.json +65 -0
- package/templates/registry/profile-settings.json +68 -0
- package/templates/registry/progress.json +19 -0
- package/templates/registry/radio-group.json +22 -0
- package/templates/registry/registry.json +2945 -0
- package/templates/registry/route-error.json +65 -0
- package/templates/registry/select-morph.json +23 -0
- package/templates/registry/select.json +23 -0
- package/templates/registry/settings-shell.json +47 -0
- package/templates/registry/sheet.json +24 -0
- package/templates/registry/sidebar.json +28 -0
- package/templates/registry/smoke.json +34 -0
- package/templates/registry/spinner.json +16 -0
- package/templates/registry/stat-card.json +18 -0
- package/templates/registry/status-badge.json +18 -0
- package/templates/registry/switch.json +20 -0
- package/templates/registry/tabs.json +23 -0
- package/templates/registry/team-settings.json +97 -0
- package/templates/registry/textarea.json +16 -0
- package/templates/registry/tooltip.json +22 -0
- package/templates/registry/trial-banner.json +43 -0
- package/templates/registry/usage.json +84 -0
- package/templates/registry/workspace-settings.json +71 -0
- package/templates/registry-items.json +116 -0
- package/templates/registry-requires.json +180 -0
- package/templates/usage-page/usage-page.tsx.tpl +23 -8
- package/templates/vitest/server-only.ts.tpl +7 -0
- package/templates/vitest/vitest.config.ts.tpl +37 -0
- package/templates/billing-page/billing-page.tsx.tpl +0 -72
package/NOTICE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Intelligo
|
|
2
|
+
Copyright 2026 Turtuvshin Byambaa and the Intelligo contributors
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see
|
|
5
|
+
LICENSE). The Intelligo name and logo are trademarks; see TRADEMARK.md
|
|
6
|
+
in the source repository, https://github.com/intelligo-dev/intelligo.
|
package/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# @intelligo-dev/cli
|
|
2
|
+
|
|
3
|
+
The Intelligo CLI: scaffold an AI SaaS app, generate owned source, and check its migrations and upgrades.
|
|
4
|
+
|
|
5
|
+
Part of [Intelligo](https://intelligo.dev), an application framework and
|
|
6
|
+
operational platform for vertical AI SaaS products. Every `@intelligo-dev/*`
|
|
7
|
+
package is released at one version and shares one database schema;
|
|
8
|
+
`pnpm dlx @intelligo-dev/cli@beta create my-app` installs the set an
|
|
9
|
+
application needs. Documentation:
|
|
10
|
+
[intelligo.dev/docs/packages/cli](https://intelligo.dev/docs/packages/cli).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add -D @intelligo-dev/cli@beta
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`create` needs no install — run it with `pnpm dlx`. The scaffold adds the CLI
|
|
19
|
+
to the new application, which is where `intelligo` comes from afterwards.
|
|
20
|
+
|
|
21
|
+
## Commands
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm dlx @intelligo-dev/cli@beta create my-app # a registry-ready Next.js app, plus the pages you pick
|
|
25
|
+
pnpm dlx @intelligo-dev/cli@beta create my-app --items chat,billing-settings --yes # no questions
|
|
26
|
+
intelligo add <feature> # generate consumer-owned source (admin-page, maintenance, vitest)
|
|
27
|
+
intelligo doctor # what is misconfigured, and why it matters
|
|
28
|
+
intelligo migrate # apply the framework chain
|
|
29
|
+
intelligo migrate --check [--json] # compare the chain with the database, change nothing
|
|
30
|
+
intelligo upgrade --check # what a template upgrade would change
|
|
31
|
+
intelligo sync [items…] # install registry pages from this release, seams kept
|
|
32
|
+
intelligo sync --check # exit 1 when an installed page drifted from the registry
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## `sync`: installed pages stay the registry's
|
|
36
|
+
|
|
37
|
+
A page arrives as source, through `shadcn add`, and nothing stops it drifting
|
|
38
|
+
afterwards — an edit here, a release skipped there. `intelligo sync` installs
|
|
39
|
+
items from the registry bundled with this CLI, so the pages match the
|
|
40
|
+
`@intelligo-dev/*` packages of the same version, in dependency order. Files an
|
|
41
|
+
item ships once for you to own (`lib/*-config`, `lib/nav-config.ts`… — the
|
|
42
|
+
`seams` in the registry's `requires.json`) are put back after the install, and
|
|
43
|
+
message files are merged key by key with your copy winning. The result is
|
|
44
|
+
recorded in `intelligo.manifest.json`.
|
|
45
|
+
|
|
46
|
+
Name the items once — `intelligo sync intelligo app-shell chat …` — and
|
|
47
|
+
afterwards a bare `intelligo sync` updates them. It refuses to overwrite a file
|
|
48
|
+
you edited by hand unless you pass `--force`: move the change into a seam
|
|
49
|
+
first. `intelligo sync --check` installs nothing, lists every file that is
|
|
50
|
+
`missing`, `edited`, `outdated`, `messages-behind` or `locale-behind`, and
|
|
51
|
+
exits 1 on any — the gate to run in CI.
|
|
52
|
+
|
|
53
|
+
### Other locales
|
|
54
|
+
|
|
55
|
+
The registry ships English (`messages/en/<item>.json`). When the app's
|
|
56
|
+
`i18n/routing.ts` lists more `locales`, `sync --check` compares each other
|
|
57
|
+
locale's copy of every shipped namespace — `messages/<locale>/<item>.json` —
|
|
58
|
+
with the app's English file on disk (the merged copy, your own keys
|
|
59
|
+
included) and reports a missing file or missing keys as `locale-behind`,
|
|
60
|
+
with the keys. `sync` never writes another locale: after it adds English
|
|
61
|
+
keys, translate them, and the check passes again.
|
|
62
|
+
|
|
63
|
+
`create` installs the pages you pick the same way: the dependencies first
|
|
64
|
+
(from the root of a parent pnpm workspace when the new app is one of its
|
|
65
|
+
members, so the workspace keeps one lockfile), then `intelligo sync` of the
|
|
66
|
+
design-system base and every item, one `shadcn add` each. Scaffold files an
|
|
67
|
+
item replaces — `app/globals.css`, the theme provider, `lib/utils.ts` — move
|
|
68
|
+
from the `app-scaffold` record to the registry's (the feature's `handedOver`
|
|
69
|
+
list), so `upgrade --check` does not report them as yours forever.
|
|
70
|
+
|
|
71
|
+
## Why `migrate` is not `drizzle-kit migrate`
|
|
72
|
+
|
|
73
|
+
Drizzle applies migrations in journal-timestamp order and skips anything
|
|
74
|
+
numbered out of sequence, so a migration published behind the last applied
|
|
75
|
+
timestamp would never run and nothing would say so. `intelligo
|
|
76
|
+
migrate` selects pending work by content hash, applies it in one transaction,
|
|
77
|
+
and records it in the same table drizzle uses so both tools agree afterwards.
|
|
78
|
+
|
|
79
|
+
It also **refuses** a database that has the schema but no records — the state
|
|
80
|
+
`drizzle-kit push` leaves behind. Applying the chain to tables that already
|
|
81
|
+
exist fails part-way; `--check` reports the database as unmanaged instead, to be
|
|
82
|
+
baselined first.
|
|
83
|
+
|
|
84
|
+
`migrate --check` exits 1 whenever anything is pending or the database is ahead,
|
|
85
|
+
which an empty database and a stale one share. A deploy gate that must tell them
|
|
86
|
+
apart reads `--json`: one object on stdout whose `state` is `up_to_date`,
|
|
87
|
+
`pending`, `fresh` (empty database), `unmanaged`, `ahead` or `legacy`, beside
|
|
88
|
+
`exitCode`, `chain`, `applied`, `pending`, `unknown`, `legacy`, `legacyMissing`
|
|
89
|
+
and `adoptable`.
|
|
90
|
+
|
|
91
|
+
## `add maintenance` and its schedule
|
|
92
|
+
|
|
93
|
+
The route reconciles executions that are ten minutes stale, so it is meant to
|
|
94
|
+
run every five minutes. `add maintenance` writes that schedule to a new
|
|
95
|
+
`vercel.json`; an existing one is never touched — the entry to add is printed
|
|
96
|
+
instead. Vercel Hobby runs a cron at most once a day and refuses a deployment
|
|
97
|
+
that asks for more: there, or on any other host, call the route from your own
|
|
98
|
+
scheduler with `Authorization: Bearer $CRON_SECRET`.
|
|
99
|
+
|
|
100
|
+
## Licence
|
|
101
|
+
|
|
102
|
+
Apache-2.0
|
package/dist/bin.js
CHANGED
|
@@ -12,14 +12,27 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { createRequire } from "node:module";
|
|
14
14
|
import path from "node:path";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
import { addFeature, formatAddResult, addExitCode, readCatalogue, } from "./commands/add.js";
|
|
17
17
|
import { exitCodeFor, formatResults, runChecks } from "./commands/doctor.js";
|
|
18
|
-
import { formatMigrateCheck, migrateCheck, migrateCheckExitCode, } from "./commands/migrate-check.js";
|
|
18
|
+
import { formatMigrateCheck, formatMigrateCheckJson, migrateCheck, migrateCheckExitCode, } from "./commands/migrate-check.js";
|
|
19
|
+
import { MIGRATIONS_TABLE_SQL, SCHEMA_PROBE_SQL, applyExitCode, applyMigrations, formatApplyResult, } from "./commands/migrate.js";
|
|
20
|
+
import { formatSyncReport, installedFrameworkVersion, selectItems, syncApply, syncCheck, syncCheckExitCode, } from "./commands/sync.js";
|
|
19
21
|
import { formatUpgradeReport, upgradeCheck, upgradeCheckExitCode, } from "./commands/upgrade-check.js";
|
|
22
|
+
import { loadAppEnv } from "./env-files.js";
|
|
23
|
+
import { resolveRegistryDir } from "./registry-bundle.js";
|
|
24
|
+
import { readRegistryCatalogue } from "./registry-items.js";
|
|
20
25
|
import { MIGRATION_LOCATIONS, resolveMigrationsDir } from "./migrations-dir.js";
|
|
21
|
-
/**
|
|
22
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Templates ship with the CLI package.
|
|
28
|
+
*
|
|
29
|
+
* `fileURLToPath`, not `new URL(...).pathname`: on Windows the latter
|
|
30
|
+
* yields `/C:/Users/...`, which every path operation after it treats as
|
|
31
|
+
* a root-relative path that does not exist. The CLI is the first thing
|
|
32
|
+
* a new user runs, so it is the worst place to be silently
|
|
33
|
+
* platform-specific.
|
|
34
|
+
*/
|
|
35
|
+
const TEMPLATES_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "templates");
|
|
23
36
|
/**
|
|
24
37
|
* Recorded in the manifest so an upgrade knows what wrote a file, and
|
|
25
38
|
* emitted as the dependency range of a scaffolded app. Read from this
|
|
@@ -31,34 +44,75 @@ function usage() {
|
|
|
31
44
|
return [
|
|
32
45
|
"intelligo <command>",
|
|
33
46
|
"",
|
|
34
|
-
" create
|
|
47
|
+
" create [dir] Scaffold an app, then install the registry pages you pick",
|
|
48
|
+
" (--items a,b | --all, --yes, --no-install)",
|
|
35
49
|
" doctor Report configuration and migration-chain problems",
|
|
36
|
-
" migrate
|
|
50
|
+
" migrate Apply the framework's migration chain to DATABASE_URL",
|
|
51
|
+
" migrate --check Compare the framework's migrations to a database",
|
|
52
|
+
" (--json: one object whose `state` is up_to_date | pending |",
|
|
53
|
+
" fresh | ahead | unmanaged | legacy)",
|
|
37
54
|
" add <feature> Generate consumer-owned source (--force to overwrite)",
|
|
38
55
|
" upgrade --check Show what a template upgrade would change",
|
|
56
|
+
" sync [items…] Install registry pages from this release's registry,",
|
|
57
|
+
" keeping seams and merging messages (--force replaces",
|
|
58
|
+
" hand-edited files; --check only reports, exit 1 on drift)",
|
|
39
59
|
"",
|
|
40
60
|
].join("\n");
|
|
41
61
|
}
|
|
42
|
-
async function
|
|
62
|
+
async function runMigrate(mode, json = false) {
|
|
43
63
|
const url = process.env.DATABASE_URL;
|
|
44
64
|
if (!url) {
|
|
45
|
-
console.error(
|
|
65
|
+
console.error(`DATABASE_URL is required for \`migrate${mode === "check" ? " --check" : ""}\`.`);
|
|
46
66
|
return 1;
|
|
47
67
|
}
|
|
48
|
-
// Imported lazily so `doctor` — the command you reach for when the
|
|
49
|
-
// app will not start — never needs a database driver to load.
|
|
50
|
-
const { Client } = await import("pg");
|
|
51
|
-
const client = new Client({ connectionString: url });
|
|
52
|
-
await client.connect();
|
|
53
68
|
const migrationsDir = resolveMigrationsDir(process.cwd());
|
|
54
69
|
if (!migrationsDir) {
|
|
55
70
|
console.error(`No migrations directory (looked in ${MIGRATION_LOCATIONS.join(", ")}) — run from the workspace root, with @intelligo-dev/core installed.`);
|
|
56
71
|
return 1;
|
|
57
72
|
}
|
|
73
|
+
// Imported lazily so `doctor` — the command you reach for when the
|
|
74
|
+
// app will not start — never needs a database driver to load.
|
|
75
|
+
const { Client } = await import("pg");
|
|
76
|
+
const client = new Client({ connectionString: url });
|
|
77
|
+
await client.connect();
|
|
58
78
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
if (mode === "check") {
|
|
80
|
+
const result = await migrateCheck(migrationsDir, async (sql) => (await client.query(sql)).rows);
|
|
81
|
+
const probe = await client.query(SCHEMA_PROBE_SQL);
|
|
82
|
+
const schemaExists = probe.rows[0]?.rel != null;
|
|
83
|
+
console.log(json
|
|
84
|
+
? formatMigrateCheckJson(result, schemaExists)
|
|
85
|
+
: formatMigrateCheck(result, schemaExists));
|
|
86
|
+
return migrateCheckExitCode(result);
|
|
87
|
+
}
|
|
88
|
+
// Applied here rather than by drizzle's migrator: the pending set is
|
|
89
|
+
// chosen by content hash — what `migrate --check` compares — and
|
|
90
|
+
// recorded in drizzle's own table, in one transaction, so a failure
|
|
91
|
+
// part-way leaves neither statements nor records behind.
|
|
92
|
+
const result = await applyMigrations({
|
|
93
|
+
migrationsDir,
|
|
94
|
+
query: async (sql) => (await client.query(sql)).rows,
|
|
95
|
+
run: async (pending) => {
|
|
96
|
+
await client.query("BEGIN");
|
|
97
|
+
try {
|
|
98
|
+
for (const ddl of MIGRATIONS_TABLE_SQL)
|
|
99
|
+
await client.query(ddl);
|
|
100
|
+
for (const migration of pending) {
|
|
101
|
+
for (const statement of migration.statements) {
|
|
102
|
+
await client.query(statement);
|
|
103
|
+
}
|
|
104
|
+
await client.query(`INSERT INTO "drizzle"."__drizzle_migrations" ("hash", "created_at") VALUES ($1, $2)`, [migration.hash, migration.createdAt]);
|
|
105
|
+
}
|
|
106
|
+
await client.query("COMMIT");
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
await client.query("ROLLBACK");
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
console.log(formatApplyResult(result));
|
|
115
|
+
return applyExitCode(result);
|
|
62
116
|
}
|
|
63
117
|
finally {
|
|
64
118
|
await client.end();
|
|
@@ -66,6 +120,11 @@ async function runMigrateCheck() {
|
|
|
66
120
|
}
|
|
67
121
|
async function main() {
|
|
68
122
|
const [, , command = "help", ...rest] = process.argv;
|
|
123
|
+
// The commands that read the app's configuration see what the app
|
|
124
|
+
// itself would: its .env.local and .env, under anything the shell set.
|
|
125
|
+
if (command === "doctor" || command === "migrate" || command === "upgrade") {
|
|
126
|
+
loadAppEnv(process.cwd());
|
|
127
|
+
}
|
|
69
128
|
switch (command) {
|
|
70
129
|
case "doctor": {
|
|
71
130
|
const results = runChecks();
|
|
@@ -73,31 +132,26 @@ async function main() {
|
|
|
73
132
|
return exitCodeFor(results);
|
|
74
133
|
}
|
|
75
134
|
case "migrate": {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
135
|
+
// Applying is the default, so a mistyped flag (`--dry-run`,
|
|
136
|
+
// `--chek`) must not fall through to it.
|
|
137
|
+
const unknown = rest.filter((arg) => arg !== "--check" && arg !== "--json");
|
|
138
|
+
if (unknown.length > 0) {
|
|
139
|
+
console.error(`intelligo migrate: unknown argument ${unknown.join(" ")}. ` +
|
|
140
|
+
"Use `intelligo migrate` to apply, `--check` to only report, " +
|
|
141
|
+
"and `--json` with `--check` for a machine-readable answer.");
|
|
142
|
+
return 2;
|
|
80
143
|
}
|
|
81
|
-
return
|
|
144
|
+
return runMigrate(rest.includes("--check") ? "check" : "apply", rest.includes("--json"));
|
|
82
145
|
}
|
|
83
146
|
case "create": {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
const result = createApp({
|
|
90
|
-
target,
|
|
147
|
+
// Imported lazily so the prompts library loads only for the one
|
|
148
|
+
// command that converses.
|
|
149
|
+
const { parseCreateFlags, runCreate } = await import("./commands/create-flow.js");
|
|
150
|
+
return runCreate(parseCreateFlags(rest), {
|
|
91
151
|
templatesDir: TEMPLATES_DIR,
|
|
92
152
|
frameworkVersion: FRAMEWORK_VERSION,
|
|
93
|
-
|
|
94
|
-
// monorepo, where the packages are workspace members. The
|
|
95
|
-
// default is a version range, because that is what works
|
|
96
|
-
// everywhere else.
|
|
97
|
-
linkWorkspace: rest.includes("--link-workspace"),
|
|
153
|
+
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
98
154
|
});
|
|
99
|
-
console.log(formatCreateResult(target, result));
|
|
100
|
-
return 0;
|
|
101
155
|
}
|
|
102
156
|
case "add": {
|
|
103
157
|
const feature = rest.find((a) => !a.startsWith("--"));
|
|
@@ -116,7 +170,7 @@ async function main() {
|
|
|
116
170
|
force: rest.includes("--force"),
|
|
117
171
|
});
|
|
118
172
|
console.log(formatAddResult(result));
|
|
119
|
-
return
|
|
173
|
+
return addExitCode(result);
|
|
120
174
|
}
|
|
121
175
|
case "upgrade": {
|
|
122
176
|
if (!rest.includes("--check")) {
|
|
@@ -133,6 +187,37 @@ async function main() {
|
|
|
133
187
|
console.log(formatUpgradeReport(report));
|
|
134
188
|
return upgradeCheckExitCode(report);
|
|
135
189
|
}
|
|
190
|
+
case "sync": {
|
|
191
|
+
const registryDir = resolveRegistryDir(TEMPLATES_DIR);
|
|
192
|
+
if (!registryDir) {
|
|
193
|
+
console.error("This CLI has no bundled registry — in the framework repository, run `pnpm registry:build` first.");
|
|
194
|
+
return 1;
|
|
195
|
+
}
|
|
196
|
+
const context = {
|
|
197
|
+
appRoot: process.cwd(),
|
|
198
|
+
registryDir,
|
|
199
|
+
requires: readRegistryCatalogue(TEMPLATES_DIR).requires,
|
|
200
|
+
frameworkVersion: FRAMEWORK_VERSION,
|
|
201
|
+
};
|
|
202
|
+
const installed = installedFrameworkVersion(context.appRoot);
|
|
203
|
+
if (installed && installed !== FRAMEWORK_VERSION) {
|
|
204
|
+
console.error(`! @intelligo-dev/core is ${installed} but this CLI carries the ${FRAMEWORK_VERSION} registry — ` +
|
|
205
|
+
"run the CLI of the same version (`pnpm exec intelligo`), or pages and packages will disagree.");
|
|
206
|
+
}
|
|
207
|
+
const selection = selectItems(rest.filter((a) => !a.startsWith("-")), context);
|
|
208
|
+
if (!selection.ok) {
|
|
209
|
+
console.error(selection.message);
|
|
210
|
+
return 1;
|
|
211
|
+
}
|
|
212
|
+
if (rest.includes("--check")) {
|
|
213
|
+
const report = syncCheck(selection.items, context);
|
|
214
|
+
console.log(formatSyncReport(report));
|
|
215
|
+
return syncCheckExitCode(report);
|
|
216
|
+
}
|
|
217
|
+
return syncApply(selection.items, context, {
|
|
218
|
+
force: rest.includes("--force"),
|
|
219
|
+
});
|
|
220
|
+
}
|
|
136
221
|
case "help":
|
|
137
222
|
console.log(usage());
|
|
138
223
|
return 0;
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,UAAU,EACV,eAAe,EACf,WAAW,EACX,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAA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AK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CACF,CAAC"}
|
package/dist/commands/add.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intelligo add <feature>` — generate consumer-owned source.
|
|
3
3
|
*
|
|
4
|
-
* "Owned" is the operative word
|
|
4
|
+
* "Owned" is the operative word: the files land in the
|
|
5
5
|
* consumer's repository and Intelligo stops deciding what is in them.
|
|
6
6
|
* The manifest records what was written and its hash so a later
|
|
7
7
|
* upgrade can tell an untouched file from one the consumer has made
|
|
@@ -11,12 +11,20 @@ export type TemplateFile = {
|
|
|
11
11
|
template: string;
|
|
12
12
|
target: string;
|
|
13
13
|
};
|
|
14
|
+
/** A route the feature needs called on a schedule (five-field cron). */
|
|
15
|
+
export type TemplateCron = {
|
|
16
|
+
path: string;
|
|
17
|
+
schedule: string;
|
|
18
|
+
};
|
|
14
19
|
export type TemplateFeature = {
|
|
15
20
|
templateVersion: string;
|
|
16
21
|
description: string;
|
|
17
22
|
/** Set when a registry item supersedes this template feature. */
|
|
18
23
|
deprecated?: string;
|
|
19
24
|
files: TemplateFile[];
|
|
25
|
+
cron?: TemplateCron;
|
|
26
|
+
/** What the developer still does by hand once the files are written. */
|
|
27
|
+
nextSteps?: string[];
|
|
20
28
|
};
|
|
21
29
|
export type TemplateCatalogue = Record<string, TemplateFeature>;
|
|
22
30
|
export declare function readCatalogue(templatesDir: string): TemplateCatalogue;
|
|
@@ -29,6 +37,16 @@ export type AddResult = {
|
|
|
29
37
|
skippedCustomized: string[];
|
|
30
38
|
/** Present but not ours (no manifest record) — left untouched. */
|
|
31
39
|
skippedUnknown: string[];
|
|
40
|
+
/**
|
|
41
|
+
* The feature's schedule and what became of it: `written` to a new
|
|
42
|
+
* vercel.json, already `present` in the app's own, or `manual` — the
|
|
43
|
+
* app has a vercel.json without it, which is the consumer's to edit.
|
|
44
|
+
*/
|
|
45
|
+
cron?: TemplateCron & {
|
|
46
|
+
status: "written" | "present" | "manual";
|
|
47
|
+
};
|
|
48
|
+
/** The catalogue's steps left to the developer, printed after the files. */
|
|
49
|
+
nextSteps?: string[];
|
|
32
50
|
};
|
|
33
51
|
export type AddOptions = {
|
|
34
52
|
appRoot: string;
|
|
@@ -43,6 +61,13 @@ export type AddOptions = {
|
|
|
43
61
|
*/
|
|
44
62
|
variables?: Record<string, string>;
|
|
45
63
|
};
|
|
64
|
+
export declare function substitute(contents: string, variables: Record<string, string> | undefined): string;
|
|
46
65
|
export declare function addFeature(feature: string, options: AddOptions): AddResult;
|
|
47
66
|
export declare function formatAddResult(r: AddResult): string;
|
|
67
|
+
/**
|
|
68
|
+
* Non-zero when a file the feature needs is still missing: one that
|
|
69
|
+
* exists but was not generated by Intelligo was left alone, so the
|
|
70
|
+
* feature is not installed as the catalogue describes it.
|
|
71
|
+
*/
|
|
72
|
+
export declare function addExitCode(r: AddResult): number;
|
|
48
73
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,MAAM,M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,OAAO,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,wBAAgB,UAAU,CACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAC5C,MAAM,CAMR;AAmCD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,SAAS,CAkF1E;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAsBpD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAEhD"}
|
package/dist/commands/add.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `intelligo add <feature>` — generate consumer-owned source.
|
|
3
3
|
*
|
|
4
|
-
* "Owned" is the operative word
|
|
4
|
+
* "Owned" is the operative word: the files land in the
|
|
5
5
|
* consumer's repository and Intelligo stops deciding what is in them.
|
|
6
6
|
* The manifest records what was written and its hash so a later
|
|
7
7
|
* upgrade can tell an untouched file from one the consumer has made
|
|
@@ -13,11 +13,38 @@ import { emptyManifest, hashContents, readManifest, recordFeature, writeManifest
|
|
|
13
13
|
export function readCatalogue(templatesDir) {
|
|
14
14
|
return JSON.parse(readFileSync(path.join(templatesDir, "manifest.json"), "utf8"));
|
|
15
15
|
}
|
|
16
|
-
function substitute(contents, variables) {
|
|
16
|
+
export function substitute(contents, variables) {
|
|
17
17
|
if (!variables)
|
|
18
18
|
return contents;
|
|
19
19
|
return Object.entries(variables).reduce((out, [key, value]) => out.split(key).join(value), contents);
|
|
20
20
|
}
|
|
21
|
+
const VERCEL_CONFIG = "vercel.json";
|
|
22
|
+
/**
|
|
23
|
+
* Schedule the cron in vercel.json when the app has none. An existing
|
|
24
|
+
* one is deployment configuration the consumer wrote: it is read to see
|
|
25
|
+
* whether the path is already scheduled, never written. The file is not
|
|
26
|
+
* recorded in the manifest either — it is the consumer's from the start.
|
|
27
|
+
*/
|
|
28
|
+
function scheduleCron(appRoot, cron) {
|
|
29
|
+
const file = path.join(appRoot, VERCEL_CONFIG);
|
|
30
|
+
if (!existsSync(file)) {
|
|
31
|
+
const config = {
|
|
32
|
+
$schema: "https://openapi.vercel.sh/vercel.json",
|
|
33
|
+
crons: [cron],
|
|
34
|
+
};
|
|
35
|
+
writeFileSync(file, JSON.stringify(config, null, 2) + "\n");
|
|
36
|
+
return "written";
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const config = JSON.parse(readFileSync(file, "utf8"));
|
|
40
|
+
return config.crons?.some((c) => c.path === cron.path)
|
|
41
|
+
? "present"
|
|
42
|
+
: "manual";
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return "manual";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
21
48
|
export function addFeature(feature, options) {
|
|
22
49
|
const catalogue = readCatalogue(options.templatesDir);
|
|
23
50
|
const spec = catalogue[feature];
|
|
@@ -35,8 +62,14 @@ export function addFeature(feature, options) {
|
|
|
35
62
|
};
|
|
36
63
|
if (spec.deprecated)
|
|
37
64
|
result.deprecated = spec.deprecated;
|
|
65
|
+
if (spec.nextSteps?.length)
|
|
66
|
+
result.nextSteps = spec.nextSteps;
|
|
38
67
|
const recorded = [];
|
|
68
|
+
const handedOver = new Set(previous?.handedOver ?? []);
|
|
39
69
|
for (const file of spec.files) {
|
|
70
|
+
// A registry item replaced it; `intelligo sync` keeps it now.
|
|
71
|
+
if (handedOver.has(file.target))
|
|
72
|
+
continue;
|
|
40
73
|
const source = path.join(options.templatesDir, file.template);
|
|
41
74
|
const target = path.join(options.appRoot, file.target);
|
|
42
75
|
const contents = substitute(readFileSync(source, "utf8"), options.variables);
|
|
@@ -63,7 +96,13 @@ export function addFeature(feature, options) {
|
|
|
63
96
|
recorded.push({ path: file.target, hash: hashContents(contents) });
|
|
64
97
|
result.written.push(file.target);
|
|
65
98
|
}
|
|
66
|
-
|
|
99
|
+
if (spec.cron) {
|
|
100
|
+
result.cron = {
|
|
101
|
+
...spec.cron,
|
|
102
|
+
status: scheduleCron(options.appRoot, spec.cron),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
writeManifest(options.appRoot, recordFeature(manifest, feature, spec.templateVersion, recorded, options.variables));
|
|
67
106
|
return result;
|
|
68
107
|
}
|
|
69
108
|
export function formatAddResult(r) {
|
|
@@ -76,8 +115,35 @@ export function formatAddResult(r) {
|
|
|
76
115
|
lines.push(` = ${f} (yours — left alone; use --force to overwrite)`);
|
|
77
116
|
for (const f of r.skippedUnknown)
|
|
78
117
|
lines.push(` ! ${f} (already exists and was not generated by Intelligo)`);
|
|
79
|
-
if (r.
|
|
118
|
+
if (r.cron?.status === "written")
|
|
119
|
+
lines.push(` + ${VERCEL_CONFIG} (${r.cron.path} on "${r.cron.schedule}")`);
|
|
120
|
+
if (r.written.length === 0 &&
|
|
121
|
+
r.skippedCustomized.length === 0 &&
|
|
122
|
+
r.skippedUnknown.length === 0 &&
|
|
123
|
+
r.cron?.status !== "written")
|
|
80
124
|
lines.push(" nothing to do");
|
|
125
|
+
if (r.cron)
|
|
126
|
+
lines.push(...cronNextSteps(r.cron));
|
|
127
|
+
if (r.nextSteps?.length) {
|
|
128
|
+
lines.push("", " Next:", ...r.nextSteps.map((step) => ` - ${step}`));
|
|
129
|
+
}
|
|
81
130
|
return lines.join("\n");
|
|
82
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Non-zero when a file the feature needs is still missing: one that
|
|
134
|
+
* exists but was not generated by Intelligo was left alone, so the
|
|
135
|
+
* feature is not installed as the catalogue describes it.
|
|
136
|
+
*/
|
|
137
|
+
export function addExitCode(r) {
|
|
138
|
+
return r.skippedUnknown.length > 0 ? 1 : 0;
|
|
139
|
+
}
|
|
140
|
+
function cronNextSteps(cron) {
|
|
141
|
+
const entry = JSON.stringify({ path: cron.path, schedule: cron.schedule });
|
|
142
|
+
const lines = ["", " Next:"];
|
|
143
|
+
if (cron.status === "manual") {
|
|
144
|
+
lines.push(` - ${VERCEL_CONFIG} is yours and was left alone. Add to its "crons":`, ` ${entry}`);
|
|
145
|
+
}
|
|
146
|
+
lines.push(" - Set CRON_SECRET (32+ characters). Vercel sends it as the Bearer token itself.", " - Vercel Hobby runs a cron at most once a day and refuses a deployment that", ` asks for more. On Hobby, or on any other host, remove the ${VERCEL_CONFIG} entry`, " and call the route from your own scheduler at the same cadence:", ` curl -fsS -H "Authorization: Bearer $CRON_SECRET" https://<your-app>${cron.path}`);
|
|
147
|
+
return lines;
|
|
148
|
+
}
|
|
83
149
|
//# sourceMappingURL=add.js.map
|
package/dist/commands/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,GAEd,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,GAEd,MAAM,gBAAgB,CAAC;AAiBxB,MAAM,UAAU,aAAa,CAAC,YAAoB;IAChD,OAAO,IAAI,CAAC,KAAK,CACf,YAAY,CAAC,IAAI,CAAC,IAAI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7B,KAAK,CAAC,IAAI,CACR,OAAO,aAAa,mDAAmD,EACvE,SAAS,KAAK,EAAE,CACjB,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,IAAI,CACR,mFAAmF,EACnF,+EAA+E,EAC/E,iEAAiE,aAAa,QAAQ,EACtF,qEAAqE,EACrE,6EAA6E,IAAI,CAAC,IAAI,EAAE,CACzF,CAAC;IACF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conversation around `createApp`: ask what the flags did not say,
|
|
3
|
+
* scaffold, and install the chosen registry items once the developer
|
|
4
|
+
* has approved the commands that do it. The items go in through
|
|
5
|
+
* `intelligo sync` — one `shadcn add` per item from the registry this
|
|
6
|
+
* CLI carries, recorded in the manifest — exactly as a later sync
|
|
7
|
+
* would put them back.
|
|
8
|
+
*
|
|
9
|
+
* Nothing runs on the developer's machine without their say-so. In a
|
|
10
|
+
* terminal the commands are shown and confirmed; without one (CI, a
|
|
11
|
+
* pipe) they run only under `--yes`, and are otherwise printed.
|
|
12
|
+
*/
|
|
13
|
+
export type CreateFlags = {
|
|
14
|
+
target?: string;
|
|
15
|
+
/** `--items a,b` — install these without asking. */
|
|
16
|
+
items?: string[];
|
|
17
|
+
/** `--all` — every page item. */
|
|
18
|
+
all: boolean;
|
|
19
|
+
/** `--yes` — approve the install commands without asking. */
|
|
20
|
+
yes: boolean;
|
|
21
|
+
/** `--no-install` — scaffold only; print the install commands. */
|
|
22
|
+
install: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* `--link-workspace` — for scaffolding inside the Intelligo monorepo,
|
|
25
|
+
* where the packages are workspace members. The default is a version
|
|
26
|
+
* range, because that is what works everywhere else.
|
|
27
|
+
*/
|
|
28
|
+
linkWorkspace: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare function parseCreateFlags(args: readonly string[]): CreateFlags;
|
|
31
|
+
export declare function runCreate(flags: CreateFlags, context: {
|
|
32
|
+
templatesDir: string;
|
|
33
|
+
frameworkVersion: string;
|
|
34
|
+
/** stdin and stdout are a terminal: prompts are allowed. */
|
|
35
|
+
interactive: boolean;
|
|
36
|
+
}): Promise<number>;
|
|
37
|
+
//# sourceMappingURL=create-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-flow.d.ts","sourceRoot":"","sources":["../../src/commands/create-flow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA6BH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,iCAAiC;IACjC,GAAG,EAAE,OAAO,CAAC;IACb,6DAA6D;IAC7D,GAAG,EAAE,OAAO,CAAC;IACb,kEAAkE;IAClE,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,CAuBrE;AAiED,wBAAsB,SAAS,CAC7B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE;IACP,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,WAAW,EAAE,OAAO,CAAC;CACtB,GACA,OAAO,CAAC,MAAM,CAAC,CAiIjB"}
|