@chris-lally/cli 0.1.0-alpha.1 → 0.1.0-alpha.6
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 +178 -8
- package/dist/bin/lally.d.ts +0 -1
- package/dist/commands/add/db.d.ts +3 -0
- package/dist/commands/add/db.js +118 -0
- package/dist/commands/add/db.js.map +1 -0
- package/dist/commands/add/fumadocs.d.ts +3 -0
- package/dist/commands/add/fumadocs.js +124 -0
- package/dist/commands/add/fumadocs.js.map +1 -0
- package/dist/commands/{add.d.ts → add/index.d.ts} +0 -1
- package/dist/commands/add/index.js +110 -0
- package/dist/commands/add/index.js.map +1 -0
- package/dist/commands/add/shared.d.ts +25 -0
- package/dist/commands/add/shared.js +111 -0
- package/dist/commands/add/shared.js.map +1 -0
- package/dist/commands/check/index.d.ts +1 -0
- package/dist/commands/check/index.js +50 -0
- package/dist/commands/check/index.js.map +1 -0
- package/dist/commands/check/shared.d.ts +15 -0
- package/dist/commands/check/shared.js +64 -0
- package/dist/commands/check/shared.js.map +1 -0
- package/dist/commands/check/targets/fumadocs.d.ts +2 -0
- package/dist/commands/check/targets/fumadocs.js +167 -0
- package/dist/commands/check/targets/fumadocs.js.map +1 -0
- package/dist/commands/clean/index.d.ts +1 -0
- package/dist/commands/clean/index.js +156 -0
- package/dist/commands/clean/index.js.map +1 -0
- package/dist/commands/clean/shared.d.ts +17 -0
- package/dist/commands/clean/shared.js +162 -0
- package/dist/commands/clean/shared.js.map +1 -0
- package/dist/commands/clean/targets/fumadocs.d.ts +5 -0
- package/dist/commands/clean/targets/fumadocs.js +13 -0
- package/dist/commands/clean/targets/fumadocs.js.map +1 -0
- package/dist/commands/fumadocs/layout-shared.d.ts +12 -0
- package/dist/commands/fumadocs/layout-shared.js +94 -0
- package/dist/commands/fumadocs/layout-shared.js.map +1 -0
- package/dist/commands/init/index.d.ts +1 -0
- package/dist/commands/init/index.js +72 -0
- package/dist/commands/init/index.js.map +1 -0
- package/dist/commands/init/presets/fumadocs-base-path.d.ts +1 -0
- package/dist/commands/init/presets/fumadocs-base-path.js +36 -0
- package/dist/commands/init/presets/fumadocs-base-path.js.map +1 -0
- package/dist/commands/init/shared.d.ts +35 -0
- package/dist/commands/init/shared.js +122 -0
- package/dist/commands/init/shared.js.map +1 -0
- package/dist/commands/release/args.d.ts +7 -0
- package/dist/commands/release/args.js +69 -0
- package/dist/commands/release/args.js.map +1 -0
- package/dist/commands/release/auth.d.ts +7 -0
- package/dist/commands/release/auth.js +49 -0
- package/dist/commands/release/auth.js.map +1 -0
- package/dist/commands/release/env.d.ts +3 -0
- package/dist/commands/release/env.js +56 -0
- package/dist/commands/release/env.js.map +1 -0
- package/dist/commands/release/exec.d.ts +1 -0
- package/dist/commands/release/exec.js +18 -0
- package/dist/commands/release/exec.js.map +1 -0
- package/dist/commands/{release.d.ts → release/index.d.ts} +0 -1
- package/dist/commands/release/index.js +138 -0
- package/dist/commands/release/index.js.map +1 -0
- package/dist/commands/release/types.d.ts +11 -0
- package/dist/commands/release/types.js +3 -0
- package/dist/commands/release/types.js.map +1 -0
- package/dist/commands/release/version.d.ts +7 -0
- package/dist/commands/release/version.js +26 -0
- package/dist/commands/release/version.js.map +1 -0
- package/dist/commands/sync/args.d.ts +16 -0
- package/dist/commands/sync/args.js +41 -0
- package/dist/commands/sync/args.js.map +1 -0
- package/dist/commands/sync/config.d.ts +23 -0
- package/dist/commands/sync/config.js +44 -0
- package/dist/commands/sync/config.js.map +1 -0
- package/dist/commands/sync/exec.d.ts +12 -0
- package/dist/commands/sync/exec.js +36 -0
- package/dist/commands/sync/exec.js.map +1 -0
- package/dist/commands/sync/handlers.d.ts +12 -0
- package/dist/commands/sync/handlers.js +264 -0
- package/dist/commands/sync/handlers.js.map +1 -0
- package/dist/commands/sync/help.d.ts +4 -0
- package/dist/commands/sync/help.js +27 -0
- package/dist/commands/sync/help.js.map +1 -0
- package/dist/commands/sync/index.d.ts +4 -0
- package/dist/commands/sync/index.js +26 -0
- package/dist/commands/sync/index.js.map +1 -0
- package/dist/commands/sync/native.d.ts +19 -0
- package/dist/commands/sync/native.js +155 -0
- package/dist/commands/sync/native.js.map +1 -0
- package/dist/commands/sync/output.d.ts +4 -0
- package/dist/commands/sync/output.js +10 -0
- package/dist/commands/sync/output.js.map +1 -0
- package/dist/commands/sync/resolve.d.ts +22 -0
- package/dist/commands/sync/resolve.js +41 -0
- package/dist/commands/sync/resolve.js.map +1 -0
- package/dist/commands/update/args.d.ts +7 -0
- package/dist/commands/update/args.js +32 -0
- package/dist/commands/update/args.js.map +1 -0
- package/dist/commands/update/config.d.ts +37 -0
- package/dist/commands/update/config.js +16 -0
- package/dist/commands/update/config.js.map +1 -0
- package/dist/commands/update/docs/readme.d.ts +1 -0
- package/dist/commands/update/docs/readme.js +198 -0
- package/dist/commands/update/docs/readme.js.map +1 -0
- package/dist/commands/update/fumadocs/layout.d.ts +1 -0
- package/dist/commands/update/fumadocs/layout.js +175 -0
- package/dist/commands/update/fumadocs/layout.js.map +1 -0
- package/dist/commands/update/help.d.ts +1 -0
- package/dist/commands/update/help.js +26 -0
- package/dist/commands/update/help.js.map +1 -0
- package/dist/commands/update/index.d.ts +1 -0
- package/dist/commands/update/index.js +26 -0
- package/dist/commands/update/index.js.map +1 -0
- package/dist/commands/update/output.d.ts +1 -0
- package/dist/commands/update/output.js +7 -0
- package/dist/commands/update/output.js.map +1 -0
- package/dist/commands/update/repo.d.ts +1 -0
- package/dist/commands/update/repo.js +18 -0
- package/dist/commands/update/repo.js.map +1 -0
- package/dist/commands/update/subtree.d.ts +1 -0
- package/dist/commands/update/subtree.js +79 -0
- package/dist/commands/update/subtree.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/main.d.ts +0 -1
- package/dist/main.js +74 -9
- package/dist/main.js.map +1 -1
- package/package.json +6 -4
- package/dist/bin/lally.d.ts.map +0 -1
- package/dist/commands/add.d.ts.map +0 -1
- package/dist/commands/add.js +0 -26
- package/dist/commands/add.js.map +0 -1
- package/dist/commands/init.d.ts +0 -2
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -28
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/release.d.ts.map +0 -1
- package/dist/commands/release.js +0 -274
- package/dist/commands/release.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/main.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @chris-lally/cli
|
|
2
2
|
|
|
3
|
-
CLI for
|
|
3
|
+
CLI for `@chris-lally/cli`.
|
|
4
|
+
|
|
5
|
+
> This README is auto-generated by `lally update readme --target cli`.
|
|
4
6
|
|
|
5
7
|
## Install
|
|
6
8
|
|
|
@@ -14,16 +16,184 @@ or run with `pnpm dlx`:
|
|
|
14
16
|
pnpm dlx @chris-lally/cli@alpha --help
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
### `lally --help`
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
lally
|
|
23
|
+
|
|
24
|
+
Usage:
|
|
25
|
+
lally <command> [options]
|
|
26
|
+
|
|
27
|
+
Commands:
|
|
28
|
+
init Initialize app config/presets
|
|
29
|
+
add Add scaffolds (fumadocs, db)
|
|
30
|
+
check Validate project setup (read-only)
|
|
31
|
+
clean Clean template leftovers (safe dry-run default)
|
|
32
|
+
update Run maintenance/update utilities
|
|
33
|
+
release Publish @chris-lally packages
|
|
34
|
+
|
|
35
|
+
Command usage:
|
|
36
|
+
lally init [fumadocs/base-path] [--app <path>]
|
|
37
|
+
lally add <namespace/item> [--app <path>]
|
|
38
|
+
lally check fumadocs [--app <path>] [--strict-layout] [--json]
|
|
39
|
+
lally clean fumadocs [--app <path>] [--keep <glob>] [--apply] [--delete]
|
|
40
|
+
lally update subtree --script <script-name> [--dir <path>] [--json]
|
|
41
|
+
lally update layout --preset notebook-topnav [--app <path>]
|
|
42
|
+
lally update readme --target <name> [--check]
|
|
43
|
+
lally release <target> --tag <tag> [--dry-run] [--json]
|
|
44
|
+
|
|
45
|
+
Examples:
|
|
46
|
+
lally init fumadocs/base-path --app apps/web
|
|
47
|
+
lally add fumadocs/sidebar-history
|
|
48
|
+
lally add fumadocs/section --name handbook --app apps/web
|
|
49
|
+
lally check fumadocs --app apps/web
|
|
50
|
+
lally check fumadocs --app apps/web --strict-layout
|
|
51
|
+
lally clean fumadocs --app apps/web
|
|
52
|
+
lally clean fumadocs --app apps/web --apply
|
|
53
|
+
lally add db/local-postgres --app apps/web
|
|
54
|
+
lally update subtree --script sync-push.sh
|
|
55
|
+
lally update subtree --target statements --action push
|
|
56
|
+
lally update layout --preset notebook-topnav --app apps/web
|
|
57
|
+
lally update readme --target cli
|
|
58
|
+
lally release fumadocs --tag alpha --dry-run
|
|
59
|
+
|
|
60
|
+
Notes:
|
|
61
|
+
- Use --app when running from monorepo root.
|
|
62
|
+
- `clean` is dry-run by default; add --apply to execute.
|
|
63
|
+
- For detailed help: lally <command> --help
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### `lally init --help`
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
Usage:
|
|
70
|
+
lally init [preset] [--app <path>]
|
|
71
|
+
|
|
72
|
+
Presets:
|
|
73
|
+
fumadocs/base-path Initialize content root + Next basePath from lally.config.json
|
|
74
|
+
|
|
75
|
+
Deprecated aliases:
|
|
76
|
+
fumadocs/dashboard Alias for fumadocs/base-path
|
|
77
|
+
|
|
78
|
+
Examples:
|
|
79
|
+
lally init --app apps/web
|
|
80
|
+
lally init fumadocs/base-path --app apps/web
|
|
81
|
+
|
|
82
|
+
Notes:
|
|
83
|
+
- If run from monorepo root, pass --app.
|
|
84
|
+
- Uses lally.config.json fumadocs.basePath/contentRoot defaults.
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### `lally add --help`
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
Usage:
|
|
91
|
+
lally add <namespace/item> [--app <path>]
|
|
92
|
+
|
|
93
|
+
Supported items:
|
|
94
|
+
fumadocs/section Add a root section under content/<contentRoot>
|
|
95
|
+
fumadocs/page-shell Add a notebook page shell component
|
|
96
|
+
fumadocs/sidebar-history Add global sidebar history banner wiring
|
|
97
|
+
db/local-postgres Add local DB create/migrate/reset scripts
|
|
98
|
+
db/master-migration Add db/migrations/tables.sql scaffold
|
|
99
|
+
db/seed-script Add local seed script + package scripts
|
|
100
|
+
|
|
101
|
+
Examples:
|
|
102
|
+
lally add fumadocs/section --name handbook --app apps/web
|
|
103
|
+
lally add fumadocs/page-shell --app apps/web
|
|
104
|
+
lally add db/local-postgres --app apps/web
|
|
105
|
+
|
|
106
|
+
Notes:
|
|
107
|
+
- If run from monorepo root, pass --app.
|
|
108
|
+
- Uses lally.config.json fumadocs.basePath/contentRoot when available.
|
|
109
|
+
```
|
|
18
110
|
|
|
19
|
-
|
|
20
|
-
- `lally add <namespace/item>`
|
|
21
|
-
- `lally release <target> --tag <tag> [--dry-run] [--json]`
|
|
111
|
+
### `lally check --help`
|
|
22
112
|
|
|
23
|
-
|
|
113
|
+
```text
|
|
114
|
+
Usage:
|
|
115
|
+
lally check fumadocs [--app <path>] [--strict-layout] [--json]
|
|
24
116
|
|
|
25
|
-
|
|
26
|
-
-
|
|
117
|
+
Checks:
|
|
118
|
+
- required .gitignore entries
|
|
119
|
+
- required app files (next.config, source.config, src/lib/source)
|
|
120
|
+
- optional strict layout preset wiring (with --strict-layout)
|
|
121
|
+
|
|
122
|
+
Examples:
|
|
123
|
+
lally check fumadocs --app apps/web
|
|
124
|
+
lally check fumadocs --app apps/web --strict-layout
|
|
125
|
+
lally check fumadocs --app apps/web --json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### `lally clean --help`
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
Usage:
|
|
132
|
+
lally clean fumadocs [--app <path>] [--keep <glob>] [--archive-dir <path>] [--apply] [--delete] [--json]
|
|
133
|
+
|
|
134
|
+
Safety defaults:
|
|
135
|
+
- dry-run by default (no file changes)
|
|
136
|
+
- use --apply to execute
|
|
137
|
+
- apply mode archives files by default
|
|
138
|
+
- use --delete to permanently remove instead of archive
|
|
139
|
+
|
|
140
|
+
Examples:
|
|
141
|
+
lally clean fumadocs --app apps/web
|
|
142
|
+
lally clean fumadocs --app apps/web --keep 'content/docs/custom/**'
|
|
143
|
+
lally clean fumadocs --app apps/web --apply
|
|
144
|
+
lally clean fumadocs --app apps/web --apply --archive-dir .lally-clean-backup/manual-1
|
|
145
|
+
lally clean fumadocs --app apps/web --apply --delete
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### `lally update --help`
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
Usage:
|
|
152
|
+
lally update subtree --script <script-name> [--dir <path>] [--json]
|
|
153
|
+
lally update subtree --target <name> --action <push|pull> [--dir <path>] [--json]
|
|
154
|
+
lally update layout --preset notebook-topnav [--app <path>]
|
|
155
|
+
lally update readme [--target <name>] [--check] [--print]
|
|
156
|
+
|
|
157
|
+
Notes:
|
|
158
|
+
- subtree uses update.subtree config in lally.config.json
|
|
159
|
+
- project.subtree is still supported as a fallback
|
|
160
|
+
- readme uses readme.targets config in lally.config.json
|
|
161
|
+
- readme auto-discovers top-level commands from <bin> --help
|
|
162
|
+
|
|
163
|
+
Examples:
|
|
164
|
+
lally update subtree --script sync-push.sh
|
|
165
|
+
lally update subtree --target statements --action push
|
|
166
|
+
lally update layout --preset notebook-topnav --app apps/web
|
|
167
|
+
lally update readme --target cli
|
|
168
|
+
lally update readme --target cli --check
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### `lally release --help`
|
|
172
|
+
|
|
173
|
+
```text
|
|
174
|
+
Usage:
|
|
175
|
+
lally release <target> --tag <tag> [--dry-run] [--json]
|
|
176
|
+
|
|
177
|
+
Targets:
|
|
178
|
+
fumadocs Publish @chris-lally/fumadocs
|
|
179
|
+
cli Publish @chris-lally/cli
|
|
180
|
+
|
|
181
|
+
Examples:
|
|
182
|
+
lally release fumadocs --tag alpha --dry-run
|
|
183
|
+
lally release fumadocs --tag alpha --json
|
|
184
|
+
|
|
185
|
+
Notes:
|
|
186
|
+
- For target=cli, README is regenerated automatically before build.
|
|
187
|
+
|
|
188
|
+
Auth resolution (first match wins):
|
|
189
|
+
1) NPM_CONFIG_USERCONFIG env var (explicit path)
|
|
190
|
+
2) generated temp npmrc from NPM_TOKEN (auto)
|
|
191
|
+
3) <repo>/.npmrc.publish
|
|
192
|
+
4) <repo>/.npmrc
|
|
193
|
+
5) default npm user config (e.g. ~/.npmrc from npm login)
|
|
194
|
+
|
|
195
|
+
NPM_TOKEN can be provided via shell env or repo .env.
|
|
196
|
+
```
|
|
27
197
|
|
|
28
198
|
## License
|
|
29
199
|
|
package/dist/bin/lally.d.ts
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDbLocalPostgres = addDbLocalPostgres;
|
|
4
|
+
exports.addDbMasterMigration = addDbMasterMigration;
|
|
5
|
+
exports.addDbSeedScript = addDbSeedScript;
|
|
6
|
+
const promises_1 = require("node:fs/promises");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const shared_1 = require("./shared");
|
|
9
|
+
async function addDbLocalPostgres(appRoot) {
|
|
10
|
+
const createScriptPath = (0, node_path_1.resolve)(appRoot, "db/scripts/create-local-db.sh");
|
|
11
|
+
const createScript = `#!/usr/bin/env bash
|
|
12
|
+
set -euo pipefail
|
|
13
|
+
|
|
14
|
+
if [ -z "\${DATABASE_URL:-}" ]; then
|
|
15
|
+
echo "Missing DATABASE_URL"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
if ! command -v psql >/dev/null 2>&1; then
|
|
20
|
+
echo "psql is required"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
DB_NAME=$(echo "$DATABASE_URL" | sed -E 's#^.*/([^/?]+).*$#\\1#')
|
|
25
|
+
if [ -z "$DB_NAME" ]; then
|
|
26
|
+
echo "Could not parse database name from DATABASE_URL"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if psql "$DATABASE_URL" -c "select 1" >/dev/null 2>&1; then
|
|
31
|
+
echo "Database already exists and is reachable: $DB_NAME"
|
|
32
|
+
exit 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
BASE_URL=$(echo "$DATABASE_URL" | sed -E 's#/(.+)$##')
|
|
36
|
+
psql "$BASE_URL/postgres" -c "CREATE DATABASE \"$DB_NAME\";" || true
|
|
37
|
+
|
|
38
|
+
echo "Ensured database exists: $DB_NAME"
|
|
39
|
+
`;
|
|
40
|
+
const scriptResult = await (0, shared_1.ensureFile)(createScriptPath, createScript);
|
|
41
|
+
if (scriptResult === "created") {
|
|
42
|
+
await (0, promises_1.writeFile)(createScriptPath, createScript, { mode: 0o755 });
|
|
43
|
+
}
|
|
44
|
+
const packageJsonPath = (0, node_path_1.resolve)(appRoot, "package.json");
|
|
45
|
+
const packageJson = await (0, shared_1.loadJson)(packageJsonPath);
|
|
46
|
+
if (packageJson) {
|
|
47
|
+
const scripts = packageJson.scripts ?? {};
|
|
48
|
+
scripts["db:create:local"] = scripts["db:create:local"] ?? "dotenv -e .env -- bash ./db/scripts/create-local-db.sh";
|
|
49
|
+
scripts["db:migrate:local"] =
|
|
50
|
+
scripts["db:migrate:local"] ??
|
|
51
|
+
"dotenv -e .env -- sh -c 'psql \"$DATABASE_URL\" -v ON_ERROR_STOP=1 -f db/migrations/tables.sql'";
|
|
52
|
+
scripts["db:reset:local"] =
|
|
53
|
+
scripts["db:reset:local"] ??
|
|
54
|
+
"dotenv -e .env -- sh -c 'psql \"$DATABASE_URL\" -v ON_ERROR_STOP=1 -c \"DROP SCHEMA public CASCADE; CREATE SCHEMA public;\"' && pnpm run db:migrate:local";
|
|
55
|
+
scripts["db:setup:local"] = scripts["db:setup:local"] ?? "pnpm run db:create:local && pnpm run db:migrate:local";
|
|
56
|
+
packageJson.scripts = scripts;
|
|
57
|
+
const devDependencies = packageJson.devDependencies ?? {};
|
|
58
|
+
if (!devDependencies["dotenv-cli"])
|
|
59
|
+
devDependencies["dotenv-cli"] = "^11.0.0";
|
|
60
|
+
packageJson.devDependencies = devDependencies;
|
|
61
|
+
await (0, shared_1.ensureJsonFile)(packageJsonPath, packageJson);
|
|
62
|
+
console.log("Updated package.json DB scripts (local postgres)");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function addDbMasterMigration(appRoot) {
|
|
66
|
+
const tablesPath = (0, node_path_1.resolve)(appRoot, "db/migrations/tables.sql");
|
|
67
|
+
const content = `-- ============================================================================
|
|
68
|
+
-- MASTER TABLE MIGRATION
|
|
69
|
+
-- Update this file in place as schema evolves; rely on git history for changes.
|
|
70
|
+
-- ============================================================================
|
|
71
|
+
|
|
72
|
+
set search_path to public;
|
|
73
|
+
create extension if not exists pgcrypto;
|
|
74
|
+
|
|
75
|
+
-- Add your tables below.
|
|
76
|
+
`;
|
|
77
|
+
const result = await (0, shared_1.ensureFile)(tablesPath, content);
|
|
78
|
+
console.log(result === "created" ? `Created ${tablesPath}` : `Skipped ${tablesPath} (already exists)`);
|
|
79
|
+
}
|
|
80
|
+
async function addDbSeedScript(appRoot) {
|
|
81
|
+
const seedPath = (0, node_path_1.resolve)(appRoot, "db/scripts/seed-local.sh");
|
|
82
|
+
const seed = `#!/usr/bin/env bash
|
|
83
|
+
set -euo pipefail
|
|
84
|
+
|
|
85
|
+
if [ -z "\${DATABASE_URL:-}" ]; then
|
|
86
|
+
echo "Missing DATABASE_URL"
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 <<'SQL'
|
|
91
|
+
set search_path to public;
|
|
92
|
+
|
|
93
|
+
-- Add seed rows here. Keep idempotent where possible.
|
|
94
|
+
SQL
|
|
95
|
+
|
|
96
|
+
echo "Seed complete"
|
|
97
|
+
`;
|
|
98
|
+
const result = await (0, shared_1.ensureFile)(seedPath, seed);
|
|
99
|
+
if (result === "created") {
|
|
100
|
+
await (0, promises_1.writeFile)(seedPath, seed, { mode: 0o755 });
|
|
101
|
+
}
|
|
102
|
+
const packageJsonPath = (0, node_path_1.resolve)(appRoot, "package.json");
|
|
103
|
+
const packageJson = await (0, shared_1.loadJson)(packageJsonPath);
|
|
104
|
+
if (packageJson) {
|
|
105
|
+
const scripts = packageJson.scripts ?? {};
|
|
106
|
+
scripts["db:seed:local"] = scripts["db:seed:local"] ?? "dotenv -e .env -- bash ./db/scripts/seed-local.sh";
|
|
107
|
+
scripts["db:setup-and-seed:local"] =
|
|
108
|
+
scripts["db:setup-and-seed:local"] ?? "pnpm run db:setup:local && pnpm run db:seed:local";
|
|
109
|
+
packageJson.scripts = scripts;
|
|
110
|
+
const devDependencies = packageJson.devDependencies ?? {};
|
|
111
|
+
if (!devDependencies["dotenv-cli"])
|
|
112
|
+
devDependencies["dotenv-cli"] = "^11.0.0";
|
|
113
|
+
packageJson.devDependencies = devDependencies;
|
|
114
|
+
await (0, shared_1.ensureJsonFile)(packageJsonPath, packageJson);
|
|
115
|
+
console.log("Updated package.json seed scripts");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=db.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../../src/commands/add/db.ts"],"names":[],"mappings":";;AAIA,gDA2DC;AAED,oDAeC;AAED,0CAwCC;AA1HD,+CAA6C;AAC7C,yCAAoC;AACpC,qCAAgE;AAEzD,KAAK,UAAU,kBAAkB,CAAC,OAAe;IACtD,MAAM,gBAAgB,GAAG,IAAA,mBAAO,EAAC,OAAO,EAAE,+BAA+B,CAAC,CAAC;IAC3E,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA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AW,CAAC,eAAsD,IAAI,EAAE,CAAC;QAClG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC;YAAE,eAAe,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;QAC9E,WAAW,CAAC,eAAe,GAAG,eAAe,CAAC;QAE9C,MAAM,IAAA,uBAAc,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addFumadocsSection = addFumadocsSection;
|
|
4
|
+
exports.addPageShell = addPageShell;
|
|
5
|
+
exports.addSidebarHistory = addSidebarHistory;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const promises_1 = require("node:fs/promises");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const shared_1 = require("./shared");
|
|
10
|
+
async function addFumadocsSection(appRoot, sectionName) {
|
|
11
|
+
const sectionSlug = sectionName.trim().toLowerCase().replace(/\s+/g, "-");
|
|
12
|
+
const sectionTitle = (0, shared_1.toTitleCase)(sectionSlug);
|
|
13
|
+
const { contentRoot } = await (0, shared_1.getFumadocsSettings)(appRoot);
|
|
14
|
+
const rootMetaPath = (0, node_path_1.resolve)(appRoot, `content/${contentRoot}/meta.json`);
|
|
15
|
+
const currentMeta = (await (0, shared_1.loadJson)(rootMetaPath)) ?? {
|
|
16
|
+
title: (0, shared_1.toTitleCase)(contentRoot),
|
|
17
|
+
root: true,
|
|
18
|
+
pages: [],
|
|
19
|
+
};
|
|
20
|
+
const pages = new Set(currentMeta.pages ?? []);
|
|
21
|
+
pages.add(sectionSlug);
|
|
22
|
+
await (0, shared_1.ensureJsonFile)(rootMetaPath, {
|
|
23
|
+
title: currentMeta.title ?? (0, shared_1.toTitleCase)(contentRoot),
|
|
24
|
+
root: true,
|
|
25
|
+
pages: Array.from(pages),
|
|
26
|
+
});
|
|
27
|
+
const sectionMetaPath = (0, node_path_1.resolve)(appRoot, `content/${contentRoot}/${sectionSlug}/meta.json`);
|
|
28
|
+
const sectionIndexPath = (0, node_path_1.resolve)(appRoot, `content/${contentRoot}/${sectionSlug}/index.mdx`);
|
|
29
|
+
await (0, shared_1.ensureJsonFile)(sectionMetaPath, {
|
|
30
|
+
title: sectionTitle,
|
|
31
|
+
root: true,
|
|
32
|
+
pages: ["index"],
|
|
33
|
+
});
|
|
34
|
+
await (0, shared_1.ensureFile)(sectionIndexPath, `---\ntitle: ${sectionTitle}\ndescription: ${sectionTitle} section\n---\n\nWelcome to ${sectionTitle}.\n`);
|
|
35
|
+
console.log(`Added section content: content/${contentRoot}/${sectionSlug}`);
|
|
36
|
+
console.log("Next: wire this section into source.config.ts and src/lib/source.ts if needed.");
|
|
37
|
+
}
|
|
38
|
+
async function addPageShell(appRoot) {
|
|
39
|
+
const target = (0, node_path_1.resolve)(appRoot, "src/components/notebook/custom-page-shell.tsx");
|
|
40
|
+
const content = `import type { ReactNode } from 'react';
|
|
41
|
+
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/notebook/page';
|
|
42
|
+
import { LLMCopyButton, ViewOptions } from '@/components/ai/page-actions';
|
|
43
|
+
import { gitConfig } from '@/lib/layout.shared';
|
|
44
|
+
|
|
45
|
+
type CustomPageShellProps = {
|
|
46
|
+
title: string;
|
|
47
|
+
description: string;
|
|
48
|
+
markdownUrl: string;
|
|
49
|
+
githubContentPath: string;
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export function CustomPageShell({
|
|
54
|
+
title,
|
|
55
|
+
description,
|
|
56
|
+
markdownUrl,
|
|
57
|
+
githubContentPath,
|
|
58
|
+
children,
|
|
59
|
+
}: CustomPageShellProps) {
|
|
60
|
+
const githubUrl = \`https://github.com/\${gitConfig.user}/\${gitConfig.repo}/blob/\${gitConfig.branch}/\${githubContentPath}\`;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<DocsPage toc={[]} tableOfContent={{ enabled: false }} tableOfContentPopover={{ enabled: false }} footer={{ enabled: false }}>
|
|
64
|
+
<DocsTitle>{title}</DocsTitle>
|
|
65
|
+
<DocsDescription className="mb-0">{description}</DocsDescription>
|
|
66
|
+
<div className="mb-6 flex flex-row items-center gap-2 border-b pb-6">
|
|
67
|
+
<LLMCopyButton markdownUrl={markdownUrl} />
|
|
68
|
+
<ViewOptions markdownUrl={markdownUrl} githubUrl={githubUrl} />
|
|
69
|
+
</div>
|
|
70
|
+
<DocsBody>{children}</DocsBody>
|
|
71
|
+
</DocsPage>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
const result = await (0, shared_1.ensureFile)(target, content);
|
|
76
|
+
console.log(result === "created" ? `Created ${target}` : `Skipped ${target} (already exists)`);
|
|
77
|
+
}
|
|
78
|
+
async function addSidebarHistory(appRoot) {
|
|
79
|
+
const { basePath, contentRoot } = await (0, shared_1.getFumadocsSettings)(appRoot);
|
|
80
|
+
const packageJsonPath = (0, node_path_1.resolve)(appRoot, "package.json");
|
|
81
|
+
const packageJson = await (0, shared_1.loadJson)(packageJsonPath);
|
|
82
|
+
if (packageJson) {
|
|
83
|
+
const dependencies = packageJson.dependencies ?? {};
|
|
84
|
+
if (!dependencies["@chris-lally/fumadocs"]) {
|
|
85
|
+
dependencies["@chris-lally/fumadocs"] = "^0.1.0-alpha.1";
|
|
86
|
+
packageJson.dependencies = dependencies;
|
|
87
|
+
await (0, shared_1.ensureJsonFile)(packageJsonPath, packageJson);
|
|
88
|
+
console.log("Added dependency: @chris-lally/fumadocs");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const componentPath = (0, node_path_1.resolve)(appRoot, "src/components/sidebar/global-history-banner.tsx");
|
|
92
|
+
const componentContent = `"use client";
|
|
93
|
+
|
|
94
|
+
import { SidebarHistoryBanner } from '@chris-lally/fumadocs';
|
|
95
|
+
|
|
96
|
+
export function GlobalHistoryBanner() {
|
|
97
|
+
return <SidebarHistoryBanner basePath="${basePath}" storageKey="${contentRoot}-sidebar-history-v1" />;
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
const result = await (0, shared_1.ensureFile)(componentPath, componentContent);
|
|
101
|
+
console.log(result === "created" ? `Created ${componentPath}` : `Skipped ${componentPath} (already exists)`);
|
|
102
|
+
const routeLayoutPath = (0, node_path_1.resolve)(appRoot, `src/app/${contentRoot}/layout.tsx`);
|
|
103
|
+
const docsLayoutPath = (0, node_path_1.resolve)(appRoot, "src/app/docs/layout.tsx");
|
|
104
|
+
const targetLayoutPath = (0, node_fs_1.existsSync)(routeLayoutPath) ? routeLayoutPath : docsLayoutPath;
|
|
105
|
+
if ((0, node_fs_1.existsSync)(targetLayoutPath)) {
|
|
106
|
+
let layout = await (0, promises_1.readFile)(targetLayoutPath, "utf8");
|
|
107
|
+
if (!layout.includes("GlobalHistoryBanner")) {
|
|
108
|
+
layout = `import { GlobalHistoryBanner } from '@/components/sidebar/global-history-banner';\n${layout}`;
|
|
109
|
+
}
|
|
110
|
+
if (!layout.includes("sidebar={{ banner: <GlobalHistoryBanner /> }}")) {
|
|
111
|
+
layout = layout.replace(/<DocsLayout([\s\S]*?)>/m, (match) => {
|
|
112
|
+
if (match.includes("sidebar={"))
|
|
113
|
+
return match;
|
|
114
|
+
return match.replace(">", "\n sidebar={{ banner: <GlobalHistoryBanner /> }}\n >");
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
await (0, promises_1.writeFile)(targetLayoutPath, layout, "utf8");
|
|
118
|
+
console.log(`Updated layout with sidebar history banner: ${targetLayoutPath}`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.log(`No src/app/${contentRoot}/layout.tsx or src/app/docs/layout.tsx found. Wire GlobalHistoryBanner manually in your DocsLayout sidebar.banner.`);
|
|
122
|
+
}
|
|
123
|
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AE,CAAC;YAC5C,MAAM,GAAG,sFAAsF,MAAM,EAAE,CAAC;QAC1G,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,+CAA+C,CAAC,EAAE,CAAC;YACtE,MAAM,GAAG,MAAM,CAAC,OAAO,CACrB,yBAAyB,EACzB,CAAC,KAAK,EAAE,EAAE;gBACR,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC;oBAAE,OAAO,KAAK,CAAC;gBAC9C,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,8DAA8D,CAAC,CAAC;YAC5F,CAAC,CACF,CAAC;QACJ,CAAC;QAED,MAAM,IAAA,oBAAS,EAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,+CAA+C,gBAAgB,EAAE,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CACT,cAAc,WAAW,oHAAoH,CAC9I,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runAddCommand = runAddCommand;
|
|
4
|
+
const db_1 = require("./db");
|
|
5
|
+
const fumadocs_1 = require("./fumadocs");
|
|
6
|
+
const shared_1 = require("./shared");
|
|
7
|
+
const SUPPORTED_ITEMS = [
|
|
8
|
+
"fumadocs/section",
|
|
9
|
+
"fumadocs/page-shell",
|
|
10
|
+
"fumadocs/sidebar-history",
|
|
11
|
+
"db/local-postgres",
|
|
12
|
+
"db/master-migration",
|
|
13
|
+
"db/seed-script",
|
|
14
|
+
];
|
|
15
|
+
function addHelp() {
|
|
16
|
+
return [
|
|
17
|
+
"Usage:",
|
|
18
|
+
" lally add <namespace/item> [--app <path>]",
|
|
19
|
+
"",
|
|
20
|
+
"Supported items:",
|
|
21
|
+
" fumadocs/section Add a root section under content/<contentRoot>",
|
|
22
|
+
" fumadocs/page-shell Add a notebook page shell component",
|
|
23
|
+
" fumadocs/sidebar-history Add global sidebar history banner wiring",
|
|
24
|
+
" db/local-postgres Add local DB create/migrate/reset scripts",
|
|
25
|
+
" db/master-migration Add db/migrations/tables.sql scaffold",
|
|
26
|
+
" db/seed-script Add local seed script + package scripts",
|
|
27
|
+
"",
|
|
28
|
+
"Examples:",
|
|
29
|
+
" lally add fumadocs/section --name handbook --app apps/web",
|
|
30
|
+
" lally add fumadocs/page-shell --app apps/web",
|
|
31
|
+
" lally add db/local-postgres --app apps/web",
|
|
32
|
+
"",
|
|
33
|
+
"Notes:",
|
|
34
|
+
" - If run from monorepo root, pass --app.",
|
|
35
|
+
" - Uses lally.config.json fumadocs.basePath/contentRoot when available.",
|
|
36
|
+
].join("\n");
|
|
37
|
+
}
|
|
38
|
+
async function runAddCommand(args) {
|
|
39
|
+
const { item, flags } = (0, shared_1.parseArgs)(args);
|
|
40
|
+
if (!item || item === "--help" || item === "-h" || item === "help") {
|
|
41
|
+
console.log(addHelp());
|
|
42
|
+
if (!item || item === "--help" || item === "-h" || item === "help") {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!item) {
|
|
47
|
+
console.error("Missing item name.");
|
|
48
|
+
console.error(addHelp());
|
|
49
|
+
process.exitCode = 1;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!SUPPORTED_ITEMS.includes(item)) {
|
|
53
|
+
console.error(`Unsupported item: ${item}`);
|
|
54
|
+
console.error(addHelp());
|
|
55
|
+
process.exitCode = 1;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const appFlag = (0, shared_1.getStringFlag)(flags, "app");
|
|
59
|
+
const appRoot = (0, shared_1.resolveAppRoot)(appFlag);
|
|
60
|
+
if (!appFlag && (0, shared_1.looksLikeMonorepoRoot)(process.cwd())) {
|
|
61
|
+
console.error("Current directory looks like a monorepo root, not an app directory.");
|
|
62
|
+
console.error("Use --app <path> (example: --app apps/web).");
|
|
63
|
+
process.exitCode = 1;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!(0, shared_1.looksLikeAppDirectory)(appRoot)) {
|
|
67
|
+
console.error(`Target path does not look like an app directory: ${appRoot}`);
|
|
68
|
+
console.error("Expected package.json plus app markers like next.config.*, src/app, or content.");
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
if (item === "fumadocs/section") {
|
|
74
|
+
const name = (0, shared_1.getStringFlag)(flags, "name");
|
|
75
|
+
if (!name) {
|
|
76
|
+
console.error("Missing required flag: --name");
|
|
77
|
+
console.log("Usage: lally add fumadocs/section --name <section-name> [--app <path>]");
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
await (0, fumadocs_1.addFumadocsSection)(appRoot, name);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (item === "fumadocs/page-shell") {
|
|
85
|
+
await (0, fumadocs_1.addPageShell)(appRoot);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (item === "fumadocs/sidebar-history") {
|
|
89
|
+
await (0, fumadocs_1.addSidebarHistory)(appRoot);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (item === "db/local-postgres") {
|
|
93
|
+
await (0, db_1.addDbLocalPostgres)(appRoot);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (item === "db/master-migration") {
|
|
97
|
+
await (0, db_1.addDbMasterMigration)(appRoot);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (item === "db/seed-script") {
|
|
101
|
+
await (0, db_1.addDbSeedScript)(appRoot);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
106
|
+
console.error(message);
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/add/index.ts"],"names":[],"mappings":";;AAmDA,sCAkFC;AArID,6BAAiF;AACjF,yCAAiF;AACjF,qCAMkB;AAUlB,MAAM,eAAe,GAAc;IACjC,kBAAkB;IAClB,qBAAqB;IACrB,0BAA0B;IAC1B,mBAAmB;IACnB,qBAAqB;IACrB,gBAAgB;CACjB,CAAC;AAEF,SAAS,OAAO;IACd,OAAO;QACL,QAAQ;QACR,6CAA6C;QAC7C,EAAE;QACF,kBAAkB;QAClB,2EAA2E;QAC3E,gEAAgE;QAChE,qEAAqE;QACrE,sEAAsE;QACtE,kEAAkE;QAClE,oEAAoE;QACpE,EAAE;QACF,WAAW;QACX,6DAA6D;QAC7D,gDAAgD;QAChD,8CAA8C;QAC9C,EAAE;QACF,QAAQ;QACR,4CAA4C;QAC5C,0EAA0E;KAC3E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAEM,KAAK,UAAU,aAAa,CAAC,IAAc;IAChD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAA,kBAAS,EAAC,IAAI,CAAC,CAAC;IAExC,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACnE,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YACnE,OAAO;QACT,CAAC;IACH,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACpC,OAAO,CAAC,KAAK,CAA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AC,wEAAwE,CAAC,CAAC;gBACtF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;gBACrB,OAAO;YACT,CAAC;YACD,MAAM,IAAA,6BAAkB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACxC,OAAO;QACT,CAAC;QAED,IAAI,IAAI,KAAK,qBAAqB,EAAE,CAAC;YACnC,MAAM,IAAA,uBAAY,EAAC,OAAO,CAAC,CAAC;YAC5B,OAAO;QACT,CAAC;QAED,IAAI,IAAI,KAAK,0BAA0B,EAAE,CAAC;YACxC,MAAM,IAAA,4BAAiB,EAAC,OAAO,CAAC,CAAC;YACjC,OAAO;QACT,CAAC;QAED,IAAI,IAAI,KAAK,mBAAmB,EAAE,CAAC;YACjC,MAAM,IAAA,uBAAkB,EAAC,OAAO,CAAC,CAAC;YAClC,OAAO;QACT,CAAC;QAED,IAAI,IAAI,KAAK,qBAAqB,EAAE,CAAC;YACnC,MAAM,IAAA,yBAAoB,EAAC,OAAO,CAAC,CAAC;YACpC,OAAO;QACT,CAAC;QAED,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAC9B,MAAM,IAAA,oBAAe,EAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ParsedArgs = {
|
|
2
|
+
item: string | undefined;
|
|
3
|
+
flags: Map<string, string | boolean>;
|
|
4
|
+
};
|
|
5
|
+
export type LallyConfig = {
|
|
6
|
+
fumadocs?: {
|
|
7
|
+
basePath?: string;
|
|
8
|
+
contentRoot?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare function parseArgs(args: string[]): ParsedArgs;
|
|
12
|
+
export declare function getStringFlag(flags: Map<string, string | boolean>, key: string): string | null;
|
|
13
|
+
export declare function toTitleCase(segment: string): string;
|
|
14
|
+
export declare function resolveAppRoot(rawAppPath: string | null): string;
|
|
15
|
+
export declare function looksLikeMonorepoRoot(dir: string): boolean;
|
|
16
|
+
export declare function looksLikeAppDirectory(dir: string): boolean;
|
|
17
|
+
export declare function ensureFile(filePath: string, content: string): Promise<"created" | "skipped">;
|
|
18
|
+
export declare function ensureJsonFile<T extends object>(filePath: string, value: T): Promise<void>;
|
|
19
|
+
export declare function loadJson<T>(filePath: string): Promise<T | null>;
|
|
20
|
+
export declare function normalizeBasePath(raw: string | undefined): string;
|
|
21
|
+
export declare function normalizeContentRoot(raw: string | undefined): string;
|
|
22
|
+
export declare function getFumadocsSettings(appRoot: string): Promise<{
|
|
23
|
+
basePath: string;
|
|
24
|
+
contentRoot: string;
|
|
25
|
+
}>;
|