@intelligo-dev/cli 1.0.0-beta.1 → 1.0.0-beta.13
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 +63 -0
- package/dist/bin.js +85 -37
- package/dist/bin.js.map +1 -1
- package/dist/commands/add.d.ts +22 -1
- package/dist/commands/add.d.ts.map +1 -1
- package/dist/commands/add.js +61 -4
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/create-flow.d.ts +34 -0
- package/dist/commands/create-flow.d.ts.map +1 -0
- package/dist/commands/create-flow.js +180 -0
- package/dist/commands/create-flow.js.map +1 -0
- package/dist/commands/create.d.ts +23 -6
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +45 -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 +293 -37
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/migrate-check.d.ts +54 -1
- package/dist/commands/migrate-check.d.ts.map +1 -1
- package/dist/commands/migrate-check.js +101 -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 +147 -0
- package/dist/commands/migrate.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 +19 -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 +9 -15
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +5 -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/registry-items.d.ts +56 -0
- package/dist/registry-items.d.ts.map +1 -0
- package/dist/registry-items.js +103 -0
- package/dist/registry-items.js.map +1 -0
- package/package.json +36 -10
- package/src/bin.ts +264 -0
- package/src/commands/add.ts +244 -0
- package/src/commands/create-flow.ts +228 -0
- package/src/commands/create.ts +139 -0
- package/src/commands/doctor.ts +487 -0
- package/src/commands/migrate-check.ts +257 -0
- package/src/commands/migrate.ts +234 -0
- package/src/commands/upgrade-check.ts +157 -0
- package/src/env-files.ts +31 -0
- package/src/index.ts +39 -0
- package/src/manifest.ts +93 -0
- package/src/migrations-dir.ts +25 -0
- package/src/migrations.ts +133 -0
- package/src/model-catalogue.ts +35 -0
- package/src/registry-items.ts +132 -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 +104 -9
- 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 +57 -18
- package/templates/registry-items.json +116 -0
- package/templates/registry-requires.json +156 -0
- package/templates/usage-page/usage-page.tsx.tpl +23 -8
- 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,63 @@
|
|
|
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)
|
|
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
|
+
```
|
|
32
|
+
|
|
33
|
+
## Why `migrate` is not `drizzle-kit migrate`
|
|
34
|
+
|
|
35
|
+
Drizzle applies migrations in journal-timestamp order and skips anything
|
|
36
|
+
numbered out of sequence, so a migration published behind the last applied
|
|
37
|
+
timestamp would never run and nothing would say so. `intelligo
|
|
38
|
+
migrate` selects pending work by content hash, applies it in one transaction,
|
|
39
|
+
and records it in the same table drizzle uses so both tools agree afterwards.
|
|
40
|
+
|
|
41
|
+
It also **refuses** a database that has the schema but no records — the state
|
|
42
|
+
`drizzle-kit push` leaves behind. Applying the chain to tables that already
|
|
43
|
+
exist fails part-way; `--check` reports the database as unmanaged instead, to be
|
|
44
|
+
baselined first.
|
|
45
|
+
|
|
46
|
+
`migrate --check` exits 1 whenever anything is pending or the database is ahead,
|
|
47
|
+
which an empty database and a stale one share. A deploy gate that must tell them
|
|
48
|
+
apart reads `--json`: one object on stdout whose `state` is `up_to_date`,
|
|
49
|
+
`pending`, `fresh` (empty database), `unmanaged`, `ahead` or `legacy`, beside
|
|
50
|
+
`exitCode`, `chain`, `applied`, `pending`, `unknown`, `legacy` and `adoptable`.
|
|
51
|
+
|
|
52
|
+
## `add maintenance` and its schedule
|
|
53
|
+
|
|
54
|
+
The route reconciles executions that are ten minutes stale, so it is meant to
|
|
55
|
+
run every five minutes. `add maintenance` writes that schedule to a new
|
|
56
|
+
`vercel.json`; an existing one is never touched — the entry to add is printed
|
|
57
|
+
instead. Vercel Hobby runs a cron at most once a day and refuses a deployment
|
|
58
|
+
that asks for more: there, or on any other host, call the route from your own
|
|
59
|
+
scheduler with `Authorization: Bearer $CRON_SECRET`.
|
|
60
|
+
|
|
61
|
+
## Licence
|
|
62
|
+
|
|
63
|
+
Apache-2.0
|
package/dist/bin.js
CHANGED
|
@@ -12,14 +12,24 @@
|
|
|
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";
|
|
19
20
|
import { formatUpgradeReport, upgradeCheck, upgradeCheckExitCode, } from "./commands/upgrade-check.js";
|
|
21
|
+
import { loadAppEnv } from "./env-files.js";
|
|
20
22
|
import { MIGRATION_LOCATIONS, resolveMigrationsDir } from "./migrations-dir.js";
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Templates ship with the CLI package.
|
|
25
|
+
*
|
|
26
|
+
* `fileURLToPath`, not `new URL(...).pathname`: on Windows the latter
|
|
27
|
+
* yields `/C:/Users/...`, which every path operation after it treats as
|
|
28
|
+
* a root-relative path that does not exist. The CLI is the first thing
|
|
29
|
+
* a new user runs, so it is the worst place to be silently
|
|
30
|
+
* platform-specific.
|
|
31
|
+
*/
|
|
32
|
+
const TEMPLATES_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "templates");
|
|
23
33
|
/**
|
|
24
34
|
* Recorded in the manifest so an upgrade knows what wrote a file, and
|
|
25
35
|
* emitted as the dependency range of a scaffolded app. Read from this
|
|
@@ -31,34 +41,72 @@ function usage() {
|
|
|
31
41
|
return [
|
|
32
42
|
"intelligo <command>",
|
|
33
43
|
"",
|
|
34
|
-
" create
|
|
44
|
+
" create [dir] Scaffold an app, then install the registry pages you pick",
|
|
45
|
+
" (--items a,b | --all, --yes, --no-install)",
|
|
35
46
|
" doctor Report configuration and migration-chain problems",
|
|
36
|
-
" migrate
|
|
47
|
+
" migrate Apply the framework's migration chain to DATABASE_URL",
|
|
48
|
+
" migrate --check Compare the framework's migrations to a database",
|
|
49
|
+
" (--json: one object whose `state` is up_to_date | pending |",
|
|
50
|
+
" fresh | ahead | unmanaged | legacy)",
|
|
37
51
|
" add <feature> Generate consumer-owned source (--force to overwrite)",
|
|
38
52
|
" upgrade --check Show what a template upgrade would change",
|
|
39
53
|
"",
|
|
40
54
|
].join("\n");
|
|
41
55
|
}
|
|
42
|
-
async function
|
|
56
|
+
async function runMigrate(mode, json = false) {
|
|
43
57
|
const url = process.env.DATABASE_URL;
|
|
44
58
|
if (!url) {
|
|
45
|
-
console.error(
|
|
59
|
+
console.error(`DATABASE_URL is required for \`migrate${mode === "check" ? " --check" : ""}\`.`);
|
|
46
60
|
return 1;
|
|
47
61
|
}
|
|
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
62
|
const migrationsDir = resolveMigrationsDir(process.cwd());
|
|
54
63
|
if (!migrationsDir) {
|
|
55
64
|
console.error(`No migrations directory (looked in ${MIGRATION_LOCATIONS.join(", ")}) — run from the workspace root, with @intelligo-dev/core installed.`);
|
|
56
65
|
return 1;
|
|
57
66
|
}
|
|
67
|
+
// Imported lazily so `doctor` — the command you reach for when the
|
|
68
|
+
// app will not start — never needs a database driver to load.
|
|
69
|
+
const { Client } = await import("pg");
|
|
70
|
+
const client = new Client({ connectionString: url });
|
|
71
|
+
await client.connect();
|
|
58
72
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
if (mode === "check") {
|
|
74
|
+
const result = await migrateCheck(migrationsDir, async (sql) => (await client.query(sql)).rows);
|
|
75
|
+
const probe = await client.query(SCHEMA_PROBE_SQL);
|
|
76
|
+
const schemaExists = probe.rows[0]?.rel != null;
|
|
77
|
+
console.log(json
|
|
78
|
+
? formatMigrateCheckJson(result, schemaExists)
|
|
79
|
+
: formatMigrateCheck(result, schemaExists));
|
|
80
|
+
return migrateCheckExitCode(result);
|
|
81
|
+
}
|
|
82
|
+
// Applied here rather than by drizzle's migrator: the pending set is
|
|
83
|
+
// chosen by content hash — what `migrate --check` compares — and
|
|
84
|
+
// recorded in drizzle's own table, in one transaction, so a failure
|
|
85
|
+
// part-way leaves neither statements nor records behind.
|
|
86
|
+
const result = await applyMigrations({
|
|
87
|
+
migrationsDir,
|
|
88
|
+
query: async (sql) => (await client.query(sql)).rows,
|
|
89
|
+
run: async (pending) => {
|
|
90
|
+
await client.query("BEGIN");
|
|
91
|
+
try {
|
|
92
|
+
for (const ddl of MIGRATIONS_TABLE_SQL)
|
|
93
|
+
await client.query(ddl);
|
|
94
|
+
for (const migration of pending) {
|
|
95
|
+
for (const statement of migration.statements) {
|
|
96
|
+
await client.query(statement);
|
|
97
|
+
}
|
|
98
|
+
await client.query(`INSERT INTO "drizzle"."__drizzle_migrations" ("hash", "created_at") VALUES ($1, $2)`, [migration.hash, migration.createdAt]);
|
|
99
|
+
}
|
|
100
|
+
await client.query("COMMIT");
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
await client.query("ROLLBACK");
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
console.log(formatApplyResult(result));
|
|
109
|
+
return applyExitCode(result);
|
|
62
110
|
}
|
|
63
111
|
finally {
|
|
64
112
|
await client.end();
|
|
@@ -66,6 +114,11 @@ async function runMigrateCheck() {
|
|
|
66
114
|
}
|
|
67
115
|
async function main() {
|
|
68
116
|
const [, , command = "help", ...rest] = process.argv;
|
|
117
|
+
// The commands that read the app's configuration see what the app
|
|
118
|
+
// itself would: its .env.local and .env, under anything the shell set.
|
|
119
|
+
if (command === "doctor" || command === "migrate" || command === "upgrade") {
|
|
120
|
+
loadAppEnv(process.cwd());
|
|
121
|
+
}
|
|
69
122
|
switch (command) {
|
|
70
123
|
case "doctor": {
|
|
71
124
|
const results = runChecks();
|
|
@@ -73,31 +126,26 @@ async function main() {
|
|
|
73
126
|
return exitCodeFor(results);
|
|
74
127
|
}
|
|
75
128
|
case "migrate": {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
129
|
+
// Applying is the default, so a mistyped flag (`--dry-run`,
|
|
130
|
+
// `--chek`) must not fall through to it.
|
|
131
|
+
const unknown = rest.filter((arg) => arg !== "--check" && arg !== "--json");
|
|
132
|
+
if (unknown.length > 0) {
|
|
133
|
+
console.error(`intelligo migrate: unknown argument ${unknown.join(" ")}. ` +
|
|
134
|
+
"Use `intelligo migrate` to apply, `--check` to only report, " +
|
|
135
|
+
"and `--json` with `--check` for a machine-readable answer.");
|
|
136
|
+
return 2;
|
|
80
137
|
}
|
|
81
|
-
return
|
|
138
|
+
return runMigrate(rest.includes("--check") ? "check" : "apply", rest.includes("--json"));
|
|
82
139
|
}
|
|
83
140
|
case "create": {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
const result = createApp({
|
|
90
|
-
target,
|
|
141
|
+
// Imported lazily so the prompts library loads only for the one
|
|
142
|
+
// command that converses.
|
|
143
|
+
const { parseCreateFlags, runCreate } = await import("./commands/create-flow.js");
|
|
144
|
+
return runCreate(parseCreateFlags(rest), {
|
|
91
145
|
templatesDir: TEMPLATES_DIR,
|
|
92
146
|
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"),
|
|
147
|
+
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
|
|
98
148
|
});
|
|
99
|
-
console.log(formatCreateResult(target, result));
|
|
100
|
-
return 0;
|
|
101
149
|
}
|
|
102
150
|
case "add": {
|
|
103
151
|
const feature = rest.find((a) => !a.startsWith("--"));
|
|
@@ -116,7 +164,7 @@ async function main() {
|
|
|
116
164
|
force: rest.includes("--force"),
|
|
117
165
|
});
|
|
118
166
|
console.log(formatAddResult(result));
|
|
119
|
-
return
|
|
167
|
+
return addExitCode(result);
|
|
120
168
|
}
|
|
121
169
|
case "upgrade": {
|
|
122
170
|
if (!rest.includes("--check")) {
|
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,WA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|
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,18 @@ 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;
|
|
20
26
|
};
|
|
21
27
|
export type TemplateCatalogue = Record<string, TemplateFeature>;
|
|
22
28
|
export declare function readCatalogue(templatesDir: string): TemplateCatalogue;
|
|
@@ -29,6 +35,14 @@ export type AddResult = {
|
|
|
29
35
|
skippedCustomized: string[];
|
|
30
36
|
/** Present but not ours (no manifest record) — left untouched. */
|
|
31
37
|
skippedUnknown: string[];
|
|
38
|
+
/**
|
|
39
|
+
* The feature's schedule and what became of it: `written` to a new
|
|
40
|
+
* vercel.json, already `present` in the app's own, or `manual` — the
|
|
41
|
+
* app has a vercel.json without it, which is the consumer's to edit.
|
|
42
|
+
*/
|
|
43
|
+
cron?: TemplateCron & {
|
|
44
|
+
status: "written" | "present" | "manual";
|
|
45
|
+
};
|
|
32
46
|
};
|
|
33
47
|
export type AddOptions = {
|
|
34
48
|
appRoot: string;
|
|
@@ -43,6 +57,13 @@ export type AddOptions = {
|
|
|
43
57
|
*/
|
|
44
58
|
variables?: Record<string, string>;
|
|
45
59
|
};
|
|
60
|
+
export declare function substitute(contents: string, variables: Record<string, string> | undefined): string;
|
|
46
61
|
export declare function addFeature(feature: string, options: AddOptions): AddResult;
|
|
47
62
|
export declare function formatAddResult(r: AddResult): string;
|
|
63
|
+
/**
|
|
64
|
+
* Non-zero when a file the feature needs is still missing: one that
|
|
65
|
+
* exists but was not generated by Intelligo was left alone, so the
|
|
66
|
+
* feature is not installed as the catalogue describes it.
|
|
67
|
+
*/
|
|
68
|
+
export declare function addExitCode(r: AddResult): number;
|
|
48
69
|
//# 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,MAAM,YAAY,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAChE,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9D,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KA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/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];
|
|
@@ -63,7 +90,13 @@ export function addFeature(feature, options) {
|
|
|
63
90
|
recorded.push({ path: file.target, hash: hashContents(contents) });
|
|
64
91
|
result.written.push(file.target);
|
|
65
92
|
}
|
|
66
|
-
|
|
93
|
+
if (spec.cron) {
|
|
94
|
+
result.cron = {
|
|
95
|
+
...spec.cron,
|
|
96
|
+
status: scheduleCron(options.appRoot, spec.cron),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
writeManifest(options.appRoot, recordFeature(manifest, feature, spec.templateVersion, recorded, options.variables));
|
|
67
100
|
return result;
|
|
68
101
|
}
|
|
69
102
|
export function formatAddResult(r) {
|
|
@@ -76,8 +109,32 @@ export function formatAddResult(r) {
|
|
|
76
109
|
lines.push(` = ${f} (yours — left alone; use --force to overwrite)`);
|
|
77
110
|
for (const f of r.skippedUnknown)
|
|
78
111
|
lines.push(` ! ${f} (already exists and was not generated by Intelligo)`);
|
|
79
|
-
if (r.
|
|
112
|
+
if (r.cron?.status === "written")
|
|
113
|
+
lines.push(` + ${VERCEL_CONFIG} (${r.cron.path} on "${r.cron.schedule}")`);
|
|
114
|
+
if (r.written.length === 0 &&
|
|
115
|
+
r.skippedCustomized.length === 0 &&
|
|
116
|
+
r.skippedUnknown.length === 0 &&
|
|
117
|
+
r.cron?.status !== "written")
|
|
80
118
|
lines.push(" nothing to do");
|
|
119
|
+
if (r.cron)
|
|
120
|
+
lines.push(...cronNextSteps(r.cron));
|
|
81
121
|
return lines.join("\n");
|
|
82
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Non-zero when a file the feature needs is still missing: one that
|
|
125
|
+
* exists but was not generated by Intelligo was left alone, so the
|
|
126
|
+
* feature is not installed as the catalogue describes it.
|
|
127
|
+
*/
|
|
128
|
+
export function addExitCode(r) {
|
|
129
|
+
return r.skippedUnknown.length > 0 ? 1 : 0;
|
|
130
|
+
}
|
|
131
|
+
function cronNextSteps(cron) {
|
|
132
|
+
const entry = JSON.stringify({ path: cron.path, schedule: cron.schedule });
|
|
133
|
+
const lines = ["", " Next:"];
|
|
134
|
+
if (cron.status === "manual") {
|
|
135
|
+
lines.push(` - ${VERCEL_CONFIG} is yours and was left alone. Add to its "crons":`, ` ${entry}`);
|
|
136
|
+
}
|
|
137
|
+
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}`);
|
|
138
|
+
return lines;
|
|
139
|
+
}
|
|
83
140
|
//# 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,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
|
|
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.
|
|
5
|
+
*
|
|
6
|
+
* Nothing runs on the developer's machine without their say-so. In a
|
|
7
|
+
* terminal the commands are shown and confirmed; without one (CI, a
|
|
8
|
+
* pipe) they run only under `--yes`, and are otherwise printed.
|
|
9
|
+
*/
|
|
10
|
+
export type CreateFlags = {
|
|
11
|
+
target?: string;
|
|
12
|
+
/** `--items a,b` — install these without asking. */
|
|
13
|
+
items?: string[];
|
|
14
|
+
/** `--all` — every page item. */
|
|
15
|
+
all: boolean;
|
|
16
|
+
/** `--yes` — approve the install commands without asking. */
|
|
17
|
+
yes: boolean;
|
|
18
|
+
/** `--no-install` — scaffold only; print the install commands. */
|
|
19
|
+
install: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* `--link-workspace` — for scaffolding inside the Intelligo monorepo,
|
|
22
|
+
* where the packages are workspace members. The default is a version
|
|
23
|
+
* range, because that is what works everywhere else.
|
|
24
|
+
*/
|
|
25
|
+
linkWorkspace: boolean;
|
|
26
|
+
};
|
|
27
|
+
export declare function parseCreateFlags(args: readonly string[]): CreateFlags;
|
|
28
|
+
export declare function runCreate(flags: CreateFlags, context: {
|
|
29
|
+
templatesDir: string;
|
|
30
|
+
frameworkVersion: string;
|
|
31
|
+
/** stdin and stdout are a terminal: prompts are allowed. */
|
|
32
|
+
interactive: boolean;
|
|
33
|
+
}): Promise<number>;
|
|
34
|
+
//# 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;;;;;;;;GAQG;AA0BH,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;AAwBD,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,CAwHjB"}
|