@solidnumber/cli 2.24.12 → 2.26.0
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/CHANGELOG.md +1678 -0
- package/README.md +1 -1
- package/dist/commands/app.d.ts +46 -12
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +347 -52
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/bring.d.ts +26 -0
- package/dist/commands/bring.d.ts.map +1 -0
- package/dist/commands/bring.js +289 -0
- package/dist/commands/bring.js.map +1 -0
- package/dist/commands/how-to.d.ts.map +1 -1
- package/dist/commands/how-to.js +44 -0
- package/dist/commands/how-to.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +10 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/pages.js +3 -2
- package/dist/commands/pages.js.map +1 -1
- package/dist/commands/pull.d.ts.map +1 -1
- package/dist/commands/pull.js +23 -1
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/render.d.ts.map +1 -1
- package/dist/commands/render.js +16 -11
- package/dist/commands/render.js.map +1 -1
- package/dist/commands/schema.d.ts.map +1 -1
- package/dist/commands/schema.js +27 -5
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/serve.js +2 -2
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +9 -2
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/site.js +1 -1
- package/dist/commands/site.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +6 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/verbs.d.ts.map +1 -1
- package/dist/commands/verbs.js +37 -9
- package/dist/commands/verbs.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/block-schema-source.d.ts +13 -0
- package/dist/lib/block-schema-source.d.ts.map +1 -1
- package/dist/lib/block-schema-source.js +24 -1
- package/dist/lib/block-schema-source.js.map +1 -1
- package/dist/lib/block-types.d.ts +8 -0
- package/dist/lib/block-types.d.ts.map +1 -1
- package/dist/lib/project-kits.d.ts +9 -2
- package/dist/lib/project-kits.d.ts.map +1 -1
- package/dist/lib/project-kits.js +42 -4
- package/dist/lib/project-kits.js.map +1 -1
- package/dist/lib/pull-readme.d.ts +11 -0
- package/dist/lib/pull-readme.d.ts.map +1 -0
- package/dist/lib/pull-readme.js +150 -0
- package/dist/lib/pull-readme.js.map +1 -0
- package/dist/lib/schema-validate.d.ts +17 -1
- package/dist/lib/schema-validate.d.ts.map +1 -1
- package/dist/lib/schema-validate.js +91 -38
- package/dist/lib/schema-validate.js.map +1 -1
- package/dist/lib/skills/index.d.ts.map +1 -1
- package/dist/lib/skills/index.js +91 -0
- package/dist/lib/skills/index.js.map +1 -1
- package/package.json +6 -4
- package/platform-docs/llms.txt +6 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Run an AI-powered business from your terminal.
|
|
4
4
|
<!-- AUTO-NUMBERS: do not edit by hand; run `npm run sync:counts` (scripts/sync-counts.ts). Verified by `npm run check:counts`, which prepublishOnly runs. -->
|
|
5
|
-
|
|
5
|
+
176 top-level commands, 700+ subcommands, 54 industries, 14 user-facing AI agents (plus 102 background workers). One CLI.
|
|
6
6
|
|
|
7
7
|
**v2.15** — the Starter Kit: `solid init <name> --company <id>` scaffolds a
|
|
8
8
|
tenant-stamped starter project bound to one Solid# company — a `CLAUDE.md`
|
package/dist/commands/app.d.ts
CHANGED
|
@@ -5,21 +5,55 @@ export declare function zipFolder(files: Array<{
|
|
|
5
5
|
content: string;
|
|
6
6
|
encoding?: 'base64';
|
|
7
7
|
}>): Uint8Array;
|
|
8
|
+
/** Which commit of which repository a folder is, when it can be known. Pure but for git. */
|
|
9
|
+
export declare function buildSource(cwd: string, env?: NodeJS.ProcessEnv): {
|
|
10
|
+
commit?: string;
|
|
11
|
+
repo?: string;
|
|
12
|
+
};
|
|
8
13
|
export declare const appCommand: Command;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*/
|
|
17
|
-
export declare function workflowYaml(o: {
|
|
18
|
-
slug: string;
|
|
14
|
+
export type Manager = 'npm' | 'pnpm' | 'yarn' | 'bun';
|
|
15
|
+
export type Mode = 'after_workflow' | 'committed' | 'build';
|
|
16
|
+
export interface RepoPlan {
|
|
17
|
+
/** after_workflow: their workflow rebuilds the folder — publish when it finishes.
|
|
18
|
+
* committed: the built folder is in git and nothing rebuilds it — publish when it changes.
|
|
19
|
+
* build: build in the workflow, then publish. */
|
|
20
|
+
mode: Mode;
|
|
21
|
+
/** The BUILT folder, relative to the repo root. '' when none could be found. */
|
|
19
22
|
folder: string;
|
|
23
|
+
/** Where package.json lives, relative to the repo root ('' = the root). */
|
|
24
|
+
appDir: string;
|
|
25
|
+
manager: Manager | null;
|
|
26
|
+
/** package.json names its package manager (`packageManager`), so the version comes from there. */
|
|
27
|
+
managerPinned: boolean;
|
|
28
|
+
/** Commands run in appDir, or null when nothing is built here. */
|
|
29
|
+
install: string | null;
|
|
20
30
|
build: string | null;
|
|
31
|
+
/** A --build the caller gave: run as written, at the repo root. */
|
|
32
|
+
customBuild: string | null;
|
|
33
|
+
/** The workflow that rebuilds the folder (after_workflow only). */
|
|
34
|
+
after: {
|
|
35
|
+
name: string;
|
|
36
|
+
file: string;
|
|
37
|
+
} | null;
|
|
38
|
+
/** What was read, in plain words — shown to the person and to an agent. */
|
|
39
|
+
found: string[];
|
|
40
|
+
/** What stops this from working. Empty = ready. */
|
|
41
|
+
problems: string[];
|
|
42
|
+
}
|
|
43
|
+
/** The folder holding the app's package.json: the root, else one level down. */
|
|
44
|
+
export declare function findAppDir(repoRoot: string): string | null;
|
|
45
|
+
export declare function findManager(repoRoot: string, appDir: string): Manager;
|
|
46
|
+
/** Read the repo's shape. Pure but for the disk and `tracked` (git by default). */
|
|
47
|
+
export declare function inspectRepo(repoRoot: string, opts?: {
|
|
48
|
+
folder?: string;
|
|
49
|
+
build?: string;
|
|
50
|
+
tracked?: (rel: string) => boolean;
|
|
51
|
+
}): RepoPlan;
|
|
52
|
+
/** The workflow `solid app github` writes. Pure — the tests read it back. */
|
|
53
|
+
export declare function workflowYaml(o: {
|
|
54
|
+
slug: string;
|
|
21
55
|
branch: string;
|
|
56
|
+
plan: RepoPlan;
|
|
57
|
+
review?: boolean;
|
|
22
58
|
}): string;
|
|
23
|
-
/** The build command a repo needs, or null when its build output is committed. */
|
|
24
|
-
export declare function detectBuild(repoRoot: string, folder: string): string | null;
|
|
25
59
|
//# sourceMappingURL=app.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/commands/app.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,UAAU,CAQ1G;AAsBD,eAAO,MAAM,UAAU,SAC+E,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/commands/app.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAAE,CAAC,GAAG,UAAU,CAQ1G;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAmBjH;AAsBD,eAAO,MAAM,UAAU,SAC+E,CAAC;AA+JvG,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AACtD,MAAM,MAAM,IAAI,GAAG,gBAAgB,GAAG,WAAW,GAAG,OAAO,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACvB;;sDAEkD;IAClD,IAAI,EAAE,IAAI,CAAC;IACX,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,kGAAkG;IAClG,aAAa,EAAE,OAAO,CAAC;IACvB,kEAAkE;IAClE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,mEAAmE;IACnE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mEAAmE;IACnE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7C,2EAA2E;IAC3E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAaD,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW1D;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAQrE;AAyCD,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CAChE,GAAG,QAAQ,CAgEhB;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CA6D1G"}
|
package/dist/commands/app.js
CHANGED
|
@@ -38,8 +38,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.appCommand = void 0;
|
|
40
40
|
exports.zipFolder = zipFolder;
|
|
41
|
+
exports.buildSource = buildSource;
|
|
42
|
+
exports.findAppDir = findAppDir;
|
|
43
|
+
exports.findManager = findManager;
|
|
44
|
+
exports.inspectRepo = inspectRepo;
|
|
41
45
|
exports.workflowYaml = workflowYaml;
|
|
42
|
-
exports.detectBuild = detectBuild;
|
|
43
46
|
/**
|
|
44
47
|
* solid app — put a designer's interactive app live for this company.
|
|
45
48
|
*
|
|
@@ -79,6 +82,29 @@ function zipFolder(files) {
|
|
|
79
82
|
}
|
|
80
83
|
return (0, fflate_1.zipSync)(entries, { level: 6 });
|
|
81
84
|
}
|
|
85
|
+
/** Which commit of which repository a folder is, when it can be known. Pure but for git. */
|
|
86
|
+
function buildSource(cwd, env = process.env) {
|
|
87
|
+
// In GitHub Actions both are given; they name the commit the workflow checked out.
|
|
88
|
+
let commit = env.GITHUB_SHA;
|
|
89
|
+
let repo = env.GITHUB_REPOSITORY;
|
|
90
|
+
if (!commit) {
|
|
91
|
+
const head = (0, child_process_1.spawnSync)('git', ['rev-parse', 'HEAD'], { cwd, encoding: 'utf8' });
|
|
92
|
+
// Only when the folder's tree is clean: a commit that is not what was built would be a lie.
|
|
93
|
+
const dirty = (0, child_process_1.spawnSync)('git', ['status', '--porcelain'], { cwd, encoding: 'utf8' });
|
|
94
|
+
if (head.status === 0 && dirty.status === 0 && !dirty.stdout.trim())
|
|
95
|
+
commit = head.stdout.trim();
|
|
96
|
+
}
|
|
97
|
+
if (!repo) {
|
|
98
|
+
const url = (0, child_process_1.spawnSync)('git', ['remote', 'get-url', 'origin'], { cwd, encoding: 'utf8' });
|
|
99
|
+
const m = url.status === 0 ? url.stdout.trim().match(/[:/]([\w.-]+\/[\w.-]+?)(?:\.git)?$/) : null;
|
|
100
|
+
if (m)
|
|
101
|
+
repo = m[1];
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
...(commit && /^[0-9a-f]{7,40}$/i.test(commit) ? { commit: commit.toLowerCase() } : {}),
|
|
105
|
+
...(repo && /^[\w.-]+\/[\w.-]+$/.test(repo) ? { repo } : {}),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
82
108
|
function done(json, out, render) {
|
|
83
109
|
if (out && out.ok === false) {
|
|
84
110
|
if (json)
|
|
@@ -112,6 +138,7 @@ exports.appCommand
|
|
|
112
138
|
.option('--name <name>', 'Display name')
|
|
113
139
|
.option('--root <folder>', 'Inside <folder>, the sub-folder that holds index.html')
|
|
114
140
|
.option('--confirm', 'Consent to publish (without it, shows what would be published)')
|
|
141
|
+
.option('--hold', 'Keep this build as a version but do NOT make it live — the owner makes it live after a look')
|
|
115
142
|
.option('--json', 'Output JSON')
|
|
116
143
|
.action(async (folder, opts) => {
|
|
117
144
|
const json = (0, json_output_1.isJsonOutput)(opts);
|
|
@@ -151,16 +178,30 @@ exports.appCommand
|
|
|
151
178
|
out = await call('publish', {
|
|
152
179
|
slug: opts.slug, upload_id: up.upload_id, confirm: true,
|
|
153
180
|
...(opts.root ? { root: opts.root } : {}), ...(opts.name ? { name: opts.name } : {}),
|
|
181
|
+
...(opts.hold ? { hold: true } : {}),
|
|
182
|
+
...buildSource(abs),
|
|
154
183
|
});
|
|
155
184
|
}
|
|
156
185
|
catch (error) {
|
|
157
186
|
return fail(json, (0, api_client_1.handleApiError)(error).message);
|
|
158
187
|
}
|
|
159
188
|
done(json, out, () => {
|
|
160
|
-
|
|
161
|
-
|
|
189
|
+
if (out.held) {
|
|
190
|
+
console.log(chalk_1.default.green(`✓ Kept as version ${out.held_version} — not live yet`));
|
|
191
|
+
console.log(` ${out.make_it_live}`);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
console.log(chalk_1.default.green(`✓ Live: ${out.url}`));
|
|
195
|
+
console.log(chalk_1.default.dim(` version ${out.published_version ?? out.live_version} · link it from a site page with a button`));
|
|
196
|
+
}
|
|
162
197
|
for (const w of out.warnings || [])
|
|
163
198
|
console.log(chalk_1.default.yellow(` ⚠ ${w}`));
|
|
199
|
+
// What nobody should have to ask us: how a change reaches the live app, and how
|
|
200
|
+
// the app sends a lead. Both come from the server, worded for this app.
|
|
201
|
+
if (out.keep_it_current)
|
|
202
|
+
console.log(`\n${out.keep_it_current}`);
|
|
203
|
+
if (out.send_a_lead)
|
|
204
|
+
console.log(`\n${out.send_a_lead}`);
|
|
164
205
|
});
|
|
165
206
|
});
|
|
166
207
|
exports.appCommand
|
|
@@ -193,10 +234,20 @@ exports.appCommand
|
|
|
193
234
|
done(json, out, () => {
|
|
194
235
|
console.log(`${out.slug} ${out.status} ${out.url ?? '(offline)'}`);
|
|
195
236
|
for (const v of out.versions || []) {
|
|
196
|
-
|
|
237
|
+
const mark = v.n === out.live_version ? ' (live)' : v.held ? ' (held — not live)' : '';
|
|
238
|
+
const from = v.commit ? ` commit ${String(v.commit).slice(0, 12)}${v.repo ? ` of ${v.repo}` : ''}` : '';
|
|
239
|
+
console.log(` v${v.n}${mark} ${v.published_at} ${v.files} files ${v.source}${from}`);
|
|
197
240
|
}
|
|
198
241
|
for (const w of out.warnings || [])
|
|
199
242
|
console.log(chalk_1.default.yellow(` ⚠ ${w}`));
|
|
243
|
+
for (const h of out.outside_hosts || []) {
|
|
244
|
+
if (h.kind !== 'solid')
|
|
245
|
+
console.log(chalk_1.default.dim(` depends on ${h.host} (${h.kind}, ${h.times}×)`));
|
|
246
|
+
}
|
|
247
|
+
if (out.how_updates_work)
|
|
248
|
+
console.log(`\n${out.how_updates_work}`);
|
|
249
|
+
if (out.send_a_lead)
|
|
250
|
+
console.log(`\n${out.send_a_lead}`);
|
|
200
251
|
});
|
|
201
252
|
}
|
|
202
253
|
catch (error) {
|
|
@@ -237,61 +288,237 @@ exports.appCommand
|
|
|
237
288
|
fail(json, (0, api_client_1.handleApiError)(error).message);
|
|
238
289
|
}
|
|
239
290
|
});
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
291
|
+
const SKIP_DIRS = new Set(['node_modules', 'dist', 'build', 'out', 'docs', 'public', 'coverage']);
|
|
292
|
+
const LIKELY_APP_DIRS = ['app', 'web', 'frontend', 'client', 'site', 'www'];
|
|
293
|
+
function readJson(file) {
|
|
294
|
+
try {
|
|
295
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function hasBuildScript(dir) {
|
|
302
|
+
return Boolean(readJson(path.join(dir, 'package.json'))?.scripts?.build);
|
|
303
|
+
}
|
|
304
|
+
/** The folder holding the app's package.json: the root, else one level down. */
|
|
305
|
+
function findAppDir(repoRoot) {
|
|
306
|
+
if (hasBuildScript(repoRoot))
|
|
307
|
+
return '';
|
|
308
|
+
let names = [];
|
|
309
|
+
try {
|
|
310
|
+
names = fs.readdirSync(repoRoot, { withFileTypes: true })
|
|
311
|
+
.filter((d) => d.isDirectory() && !d.name.startsWith('.') && !SKIP_DIRS.has(d.name))
|
|
312
|
+
.map((d) => d.name).sort();
|
|
313
|
+
}
|
|
314
|
+
catch {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
const with_build = names.filter((n) => hasBuildScript(path.join(repoRoot, n)));
|
|
318
|
+
if (!with_build.length)
|
|
319
|
+
return null;
|
|
320
|
+
return LIKELY_APP_DIRS.find((n) => with_build.includes(n)) ?? with_build[0];
|
|
321
|
+
}
|
|
322
|
+
function findManager(repoRoot, appDir) {
|
|
323
|
+
for (const dir of [path.join(repoRoot, appDir), repoRoot]) {
|
|
324
|
+
if (fs.existsSync(path.join(dir, 'pnpm-lock.yaml')))
|
|
325
|
+
return 'pnpm';
|
|
326
|
+
if (fs.existsSync(path.join(dir, 'yarn.lock')))
|
|
327
|
+
return 'yarn';
|
|
328
|
+
if (fs.existsSync(path.join(dir, 'bun.lockb')) || fs.existsSync(path.join(dir, 'bun.lock')))
|
|
329
|
+
return 'bun';
|
|
330
|
+
if (fs.existsSync(path.join(dir, 'package-lock.json')))
|
|
331
|
+
return 'npm';
|
|
332
|
+
}
|
|
333
|
+
return 'npm';
|
|
334
|
+
}
|
|
335
|
+
function installCommand(m, repoRoot, appDir) {
|
|
336
|
+
if (m === 'pnpm')
|
|
337
|
+
return 'pnpm install --frozen-lockfile';
|
|
338
|
+
if (m === 'yarn')
|
|
339
|
+
return 'yarn install --frozen-lockfile';
|
|
340
|
+
if (m === 'bun')
|
|
341
|
+
return 'bun install --frozen-lockfile';
|
|
342
|
+
return fs.existsSync(path.join(repoRoot, appDir, 'package-lock.json')) ? 'npm ci' : 'npm install';
|
|
343
|
+
}
|
|
344
|
+
/** Vite's `outDir`, when the config sets one. */
|
|
345
|
+
function viteOutDir(dir) {
|
|
346
|
+
for (const f of ['vite.config.ts', 'vite.config.js', 'vite.config.mts', 'vite.config.mjs']) {
|
|
347
|
+
try {
|
|
348
|
+
const m = fs.readFileSync(path.join(dir, f), 'utf8').match(/outDir\s*:\s*["'`]([^"'`]+)["'`]/);
|
|
349
|
+
if (m)
|
|
350
|
+
return m[1];
|
|
351
|
+
}
|
|
352
|
+
catch { /* no such config */ }
|
|
353
|
+
}
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
function gitTracked(repoRoot, rel) {
|
|
357
|
+
return (0, child_process_1.spawnSync)('git', ['ls-files', '--error-unmatch', rel], { cwd: repoRoot, encoding: 'utf8' }).status === 0;
|
|
358
|
+
}
|
|
359
|
+
/** A workflow of THEIRS that rebuilds `folder` and commits it back. */
|
|
360
|
+
function rebuildingWorkflow(repoRoot, folder) {
|
|
361
|
+
const dir = path.join(repoRoot, '.github', 'workflows');
|
|
362
|
+
let files = [];
|
|
363
|
+
try {
|
|
364
|
+
files = fs.readdirSync(dir).filter((f) => /\.ya?ml$/.test(f) && !f.startsWith('solid-app-')).sort();
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
const top = folder.split('/')[0];
|
|
370
|
+
const names = new RegExp(`(^|[\\s"'/])${top.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}([\\s"'/]|$)`, 'm');
|
|
371
|
+
for (const f of files) {
|
|
372
|
+
const text = fs.readFileSync(path.join(dir, f), 'utf8');
|
|
373
|
+
if (!/git\s+push/.test(text) || !names.test(text))
|
|
374
|
+
continue;
|
|
375
|
+
const name = text.match(/^name:\s*["']?(.+?)["']?\s*$/m)?.[1];
|
|
376
|
+
// GitHub names an unnamed workflow by its path.
|
|
377
|
+
return { name: name || `.github/workflows/${f}`, file: `.github/workflows/${f}` };
|
|
378
|
+
}
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
/** Read the repo's shape. Pure but for the disk and `tracked` (git by default). */
|
|
382
|
+
function inspectRepo(repoRoot, opts = {}) {
|
|
383
|
+
const tracked = opts.tracked ?? ((rel) => gitTracked(repoRoot, rel));
|
|
384
|
+
const found = [];
|
|
385
|
+
const problems = [];
|
|
386
|
+
const appDir = findAppDir(repoRoot);
|
|
387
|
+
const at = appDir === null ? repoRoot : path.join(repoRoot, appDir);
|
|
388
|
+
const pkg = appDir === null ? null : readJson(path.join(at, 'package.json'));
|
|
389
|
+
const manager = appDir === null ? null : findManager(repoRoot, appDir);
|
|
390
|
+
if (appDir !== null) {
|
|
391
|
+
found.push(`the app's package.json is at ${appDir || 'the repo root'} (build script: ${pkg?.scripts?.build})`);
|
|
392
|
+
found.push(`it installs with ${manager}`);
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
found.push('no package.json with a build script, so nothing is built here');
|
|
396
|
+
}
|
|
397
|
+
// The BUILT folder: given, else the first place an index.html already sits.
|
|
398
|
+
let folder = (opts.folder || '').replace(/^\.\//, '').replace(/\/+$/, '');
|
|
399
|
+
if (!folder) {
|
|
400
|
+
const out = appDir !== null ? viteOutDir(at) : null;
|
|
401
|
+
const rel = (d) => (appDir ? path.posix.join(appDir, d) : d);
|
|
402
|
+
const candidates = [
|
|
403
|
+
...(out ? [path.posix.normalize(rel(out))] : []),
|
|
404
|
+
'docs', rel('dist'), rel('build'), rel('out'), 'dist', 'build', 'out',
|
|
405
|
+
].filter((c, n, all) => !c.startsWith('..') && all.indexOf(c) === n);
|
|
406
|
+
const built = candidates.filter((c) => fs.existsSync(path.join(repoRoot, c, 'index.html')));
|
|
407
|
+
folder = built.find((c) => tracked(`${c}/index.html`)) ?? built[0] ?? '';
|
|
408
|
+
if (folder)
|
|
409
|
+
found.push(`the built app (index.html) is in ${folder}/`);
|
|
410
|
+
else if (appDir !== null) {
|
|
411
|
+
folder = out ? path.posix.normalize(rel(out)) : rel('dist');
|
|
412
|
+
found.push(`no built folder on disk yet; the build writes ${folder}/ `
|
|
413
|
+
+ `(${out ? 'vite.config outDir' : 'Vite\'s default — pass --folder if yours differs'})`);
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
problems.push('No built app found: no folder with an index.html (looked in docs, dist, build, out) '
|
|
417
|
+
+ 'and no package.json to build one. Pass --folder <the folder with index.html>.');
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const committed = Boolean(folder) && tracked(`${folder}/index.html`);
|
|
421
|
+
const after = committed ? rebuildingWorkflow(repoRoot, folder) : null;
|
|
422
|
+
let mode = 'build';
|
|
423
|
+
if (opts.build) {
|
|
424
|
+
found.push(`builds with the command you gave: ${opts.build}`);
|
|
425
|
+
}
|
|
426
|
+
else if (after) {
|
|
427
|
+
mode = 'after_workflow';
|
|
428
|
+
found.push(`${folder}/ is committed, and your workflow "${after.name}" (${after.file}) rebuilds it and pushes it back`);
|
|
429
|
+
found.push('so the publish runs when that workflow finishes — publishing on push would send the previous build');
|
|
430
|
+
}
|
|
431
|
+
else if (committed) {
|
|
432
|
+
mode = 'committed';
|
|
433
|
+
found.push(`${folder}/ is committed and nothing rebuilds it, so it is published as it is whenever it changes`);
|
|
434
|
+
}
|
|
435
|
+
else if (appDir === null && folder) {
|
|
436
|
+
mode = 'committed';
|
|
437
|
+
problems.push(`${folder}/ is not committed and there is nothing to build it. Commit it, or pass --build <command>.`);
|
|
438
|
+
}
|
|
439
|
+
const builds = mode === 'build' && !opts.build && appDir !== null && manager !== null;
|
|
440
|
+
return {
|
|
441
|
+
mode, folder, appDir: appDir ?? '', manager,
|
|
442
|
+
managerPinned: Boolean(pkg?.packageManager),
|
|
443
|
+
install: builds ? installCommand(manager, repoRoot, appDir) : null,
|
|
444
|
+
build: builds ? `${manager} run build` : null,
|
|
445
|
+
customBuild: opts.build ?? null,
|
|
446
|
+
after, found, problems,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
/** The workflow `solid app github` writes. Pure — the tests read it back. */
|
|
248
450
|
function workflowYaml(o) {
|
|
249
|
-
const
|
|
250
|
-
|
|
451
|
+
const { plan } = o;
|
|
452
|
+
const file = `solid-app-${o.slug}.yml`;
|
|
453
|
+
const trigger = plan.mode === 'after_workflow'
|
|
454
|
+
? ` workflow_run:\n workflows: [${JSON.stringify(plan.after.name)}]\n types: [completed]\n branches: [${o.branch}]\n`
|
|
455
|
+
: plan.mode === 'committed'
|
|
456
|
+
? ` push:\n branches: [${o.branch}]\n paths: ["${plan.folder}/**", ".github/workflows/${file}"]\n`
|
|
457
|
+
: ` push:\n branches: [${o.branch}]\n`;
|
|
458
|
+
const gate = plan.mode === 'after_workflow'
|
|
459
|
+
? " if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}\n"
|
|
460
|
+
: '';
|
|
461
|
+
// After their workflow: the branch HEAD, which now holds the rebuilt folder.
|
|
462
|
+
const checkout = plan.mode === 'after_workflow'
|
|
463
|
+
? ` - uses: actions/checkout@v4\n with:\n ref: ${o.branch}\n`
|
|
464
|
+
: ' - uses: actions/checkout@v4\n';
|
|
465
|
+
const node = ' - uses: actions/setup-node@v4\n with:\n node-version: 22\n';
|
|
466
|
+
let build = '';
|
|
467
|
+
if (plan.customBuild) {
|
|
468
|
+
build = `${node} - run: ${plan.customBuild}\n`;
|
|
469
|
+
}
|
|
470
|
+
else if (plan.build) {
|
|
471
|
+
const wd = plan.appDir ? ` working-directory: ${plan.appDir}\n` : '';
|
|
472
|
+
const pm = plan.manager === 'pnpm'
|
|
473
|
+
? ' - uses: pnpm/action-setup@v4\n with:\n'
|
|
474
|
+
+ (plan.managerPinned
|
|
475
|
+
? ` package_json_file: ${plan.appDir ? `${plan.appDir}/` : ''}package.json\n`
|
|
476
|
+
: ' version: latest\n')
|
|
477
|
+
: plan.manager === 'bun' ? ' - uses: oven-sh/setup-bun@v2\n' : '';
|
|
478
|
+
build = `${pm}${node} - run: ${plan.install}\n${wd} - run: ${plan.build}\n${wd}`;
|
|
479
|
+
}
|
|
480
|
+
const when = plan.mode === 'after_workflow' ? `each time "${plan.after.name}" finishes on ${o.branch}`
|
|
481
|
+
: plan.mode === 'committed' ? `each time ${plan.folder}/ changes on ${o.branch}`
|
|
482
|
+
: `on every push to ${o.branch}`;
|
|
483
|
+
const held = o.review
|
|
484
|
+
? '\n# REVIEW MODE: each build is kept as a version and is NOT live until the owner makes it live\n'
|
|
485
|
+
+ `# (Apps → Hosted → Make live, or: solid app rollback ${o.slug} <version> --confirm).`
|
|
251
486
|
: '';
|
|
252
|
-
return `# Publishes ${
|
|
487
|
+
return `# Publishes ${plan.folder}/ to Solid# as the app "${o.slug}" ${when}.${held}
|
|
253
488
|
# Written by \`solid app github\`. The key (secret SOLID_API_KEY) can only publish apps.
|
|
489
|
+
#
|
|
490
|
+
# For whoever (or whichever AI) reads this file later:
|
|
491
|
+
# - Solid# never pulls from this repository. THIS workflow is the only thing that
|
|
492
|
+
# updates the live app. If the live app is behind, check this workflow's last run.
|
|
493
|
+
# - Which build is live, and from which commit: npx -y @solidnumber/cli@latest app get ${o.slug}
|
|
494
|
+
# - Put an earlier version back: npx -y @solidnumber/cli@latest app rollback ${o.slug} <version> --confirm
|
|
495
|
+
# - This repository can be private. GitHub Pages is not needed.
|
|
496
|
+
# - Everything else: npx -y @solidnumber/cli@latest app --help
|
|
254
497
|
name: Publish ${o.slug} to Solid#
|
|
255
498
|
on:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
499
|
+
${trigger} workflow_dispatch:
|
|
500
|
+
concurrency:
|
|
501
|
+
group: solid-app-${o.slug}
|
|
502
|
+
cancel-in-progress: false
|
|
259
503
|
jobs:
|
|
260
504
|
publish:
|
|
261
|
-
runs-on: ubuntu-latest
|
|
505
|
+
${gate} runs-on: ubuntu-latest
|
|
262
506
|
steps:
|
|
263
|
-
-
|
|
264
|
-
${build} - run: npx -y @solidnumber/cli@latest app publish ${o.folder} --slug ${o.slug} --confirm
|
|
507
|
+
${checkout}${build} - run: npx -y @solidnumber/cli@latest app publish ${plan.folder} --slug ${o.slug} --confirm${o.review ? ' --hold' : ''}
|
|
265
508
|
env:
|
|
266
509
|
SOLID_API_KEY: \${{ secrets.SOLID_API_KEY }}
|
|
267
510
|
NO_UPDATE_NOTIFIER: '1'
|
|
268
511
|
`;
|
|
269
512
|
}
|
|
270
|
-
/** The build command a repo needs, or null when its build output is committed. */
|
|
271
|
-
function detectBuild(repoRoot, folder) {
|
|
272
|
-
if (fs.existsSync(path.join(repoRoot, folder, 'index.html')))
|
|
273
|
-
return null; // built output is committed
|
|
274
|
-
const pkgPath = path.join(repoRoot, 'package.json');
|
|
275
|
-
if (!fs.existsSync(pkgPath))
|
|
276
|
-
return null;
|
|
277
|
-
try {
|
|
278
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
279
|
-
if (!pkg.scripts?.build)
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
catch {
|
|
283
|
-
return null;
|
|
284
|
-
}
|
|
285
|
-
const lock = fs.existsSync(path.join(repoRoot, 'package-lock.json'));
|
|
286
|
-
return `${lock ? 'npm ci' : 'npm install'} && npm run build`;
|
|
287
|
-
}
|
|
288
513
|
exports.appCommand
|
|
289
514
|
.command('github')
|
|
290
|
-
.description('Publish this repo\'s app on every
|
|
515
|
+
.description('Publish this repo\'s app on every change — private repos too. Run once, in the repo. Reads the repo itself: no flags needed but --slug.')
|
|
291
516
|
.requiredOption('--slug <slug>', "The app's name in its address, e.g. sell")
|
|
292
|
-
.
|
|
293
|
-
.option('--build <command>', 'Build command
|
|
517
|
+
.option('--folder <folder>', 'The BUILT folder, relative to the repo root. Found for you when left out (docs, dist, build, out, or <app>/dist)')
|
|
518
|
+
.option('--build <command>', 'Build command to run instead of the one found (run at the repo root)')
|
|
294
519
|
.option('--branch <branch>', 'Branch to publish from', 'main')
|
|
520
|
+
.option('--review', 'Each build waits for the owner: it is kept as a version and goes live only when they make it live')
|
|
521
|
+
.option('--plan', 'Only show what was found and what would be written. Creates no key, writes no file')
|
|
295
522
|
.option('--json', 'Output JSON')
|
|
296
523
|
.action(async (opts) => {
|
|
297
524
|
const json = (0, json_output_1.isJsonOutput)(opts);
|
|
@@ -299,8 +526,27 @@ exports.appCommand
|
|
|
299
526
|
if (top.status !== 0)
|
|
300
527
|
return fail(json, 'Run this inside the app\'s git repository.');
|
|
301
528
|
const repoRoot = top.stdout.trim();
|
|
302
|
-
const
|
|
303
|
-
const
|
|
529
|
+
const plan = inspectRepo(repoRoot, { folder: opts.folder, build: opts.build });
|
|
530
|
+
const rel = path.posix.join('.github', 'workflows', `solid-app-${opts.slug}.yml`);
|
|
531
|
+
if (plan.problems.length) {
|
|
532
|
+
return fail(json, plan.problems[0], { found: plan.found, problems: plan.problems });
|
|
533
|
+
}
|
|
534
|
+
const yaml = workflowYaml({ slug: opts.slug, branch: opts.branch, plan, review: Boolean(opts.review) });
|
|
535
|
+
const when = plan.mode === 'after_workflow' ? `each time "${plan.after.name}" finishes`
|
|
536
|
+
: plan.mode === 'committed' ? `each time ${plan.folder}/ changes` : `on every push to ${opts.branch}`;
|
|
537
|
+
if (opts.plan) {
|
|
538
|
+
const out = { ok: true, plan_only: true, mode: plan.mode, folder: plan.folder, app_dir: plan.appDir || '.',
|
|
539
|
+
manager: plan.manager, publishes: when, review: Boolean(opts.review), found: plan.found,
|
|
540
|
+
workflow: rel, workflow_yaml: yaml,
|
|
541
|
+
next: `solid app github --slug ${opts.slug}${opts.folder ? ` --folder ${opts.folder}` : ''}` };
|
|
542
|
+
if (json)
|
|
543
|
+
return (0, json_output_1.printJson)(out);
|
|
544
|
+
for (const f of plan.found)
|
|
545
|
+
console.log(chalk_1.default.dim(` · ${f}`));
|
|
546
|
+
console.log(`Would write ${rel}: publishes ${plan.folder}/ ${when}.`);
|
|
547
|
+
console.log(chalk_1.default.dim(`Run it for real: ${out.next}`));
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
304
550
|
// 1. a key that can only publish apps
|
|
305
551
|
let key;
|
|
306
552
|
let keyId;
|
|
@@ -317,19 +563,29 @@ exports.appCommand
|
|
|
317
563
|
const gh = (0, child_process_1.spawnSync)('gh', ['secret', 'set', 'SOLID_API_KEY', '--body', key], { cwd: repoRoot, encoding: 'utf8' });
|
|
318
564
|
const secretSet = gh.status === 0;
|
|
319
565
|
// 3. the workflow
|
|
566
|
+
const file = path.join(repoRoot, rel);
|
|
320
567
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
321
|
-
fs.writeFileSync(file,
|
|
322
|
-
|
|
568
|
+
fs.writeFileSync(file, yaml);
|
|
569
|
+
// The exact commands, in order. An agent runs them as written; nobody is asked anything.
|
|
570
|
+
const steps = [
|
|
571
|
+
...(secretSet ? [] : ['gh secret set SOLID_API_KEY # paste the key below when asked (or: repo Settings → Secrets and variables → Actions)']),
|
|
572
|
+
`git add ${rel} && git commit -m "Publish ${opts.slug} to Solid# automatically" && git push`,
|
|
573
|
+
`gh workflow run solid-app-${opts.slug}.yml # publish the current build now`,
|
|
574
|
+
`solid app get ${opts.slug} # the live address, the version, the commit it came from`,
|
|
575
|
+
...(opts.review ? [`solid app rollback ${opts.slug} <version> --confirm # the owner's yes: makes a held version live`] : []),
|
|
576
|
+
];
|
|
323
577
|
const out = {
|
|
324
|
-
ok: true, workflow: rel,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
578
|
+
ok: true, workflow: rel, mode: plan.mode, folder: plan.folder, app_dir: plan.appDir || '.',
|
|
579
|
+
manager: plan.manager, publishes: when, review: Boolean(opts.review), found: plan.found,
|
|
580
|
+
key_id: keyId, key_scope: 'apps:write', secret_set: secretSet, steps,
|
|
581
|
+
next: steps[0],
|
|
328
582
|
...(secretSet ? {} : { key }),
|
|
329
583
|
};
|
|
330
584
|
if (json)
|
|
331
585
|
return (0, json_output_1.printJson)(out);
|
|
332
|
-
|
|
586
|
+
for (const f of plan.found)
|
|
587
|
+
console.log(chalk_1.default.dim(` · ${f}`));
|
|
588
|
+
console.log(chalk_1.default.green(`✓ Wrote ${rel}`) + chalk_1.default.dim(` (publishes ${plan.folder}/ ${when})`));
|
|
333
589
|
console.log(chalk_1.default.green(`✓ Created key ${keyId} — it can only publish apps`));
|
|
334
590
|
if (secretSet)
|
|
335
591
|
console.log(chalk_1.default.green('✓ Saved it as the repo secret SOLID_API_KEY'));
|
|
@@ -337,6 +593,45 @@ exports.appCommand
|
|
|
337
593
|
console.log(chalk_1.default.yellow(' GitHub CLI not available — add this as the repo secret SOLID_API_KEY (shown once):'));
|
|
338
594
|
console.log(` ${key}`);
|
|
339
595
|
}
|
|
340
|
-
console.log(
|
|
596
|
+
console.log('Now run, in order:');
|
|
597
|
+
steps.forEach((st, n) => console.log(` ${n + 1}. ${st}`));
|
|
341
598
|
});
|
|
599
|
+
exports.appCommand.addHelpText('after', `
|
|
600
|
+
PAGE OR APP — the one question: does it need its OWN JavaScript to do its job?
|
|
601
|
+
NO → a PAGE. Import it (solid verbs invoke design.intake names the door). It lives on
|
|
602
|
+
<company>.solidnumber.com as editable blocks; the owner, their AI and Solid# can change
|
|
603
|
+
every word and image, and it follows the brand (logo, colours).
|
|
604
|
+
YES → an APP. Publish its built files with the commands below. It lives at
|
|
605
|
+
<company>.solidhost.app/<name>/, runs exactly as built, and only its developer can
|
|
606
|
+
change it. A brand change in Solid# does not reach it.
|
|
607
|
+
How to tell: picture it with JavaScript off. Only polish lost (animation, menus) → page.
|
|
608
|
+
It stops doing its job (steps, camera, calculator) → app.
|
|
609
|
+
Why two addresses: every solidnumber.com address shares the dashboard's sign-in, so outside
|
|
610
|
+
script never runs there. solidhost.app is a separate domain where it can.
|
|
611
|
+
Most businesses have both: pages, plus a button that opens the app. A business can have many
|
|
612
|
+
apps (/sell/, /quote/). ".app" is a domain ending, not the App Store.
|
|
613
|
+
|
|
614
|
+
For an AI agent — do this in order and ask the person nothing:
|
|
615
|
+
1. solid app github --slug <name> --plan --json reads the repo: the built folder, how it builds, when to publish
|
|
616
|
+
2. solid app github --slug <name> --json writes the workflow and a publish-only key
|
|
617
|
+
3. run the "steps" it returns, exactly as written
|
|
618
|
+
Publish once by hand instead: solid app publish <built folder> --slug <name> --confirm
|
|
619
|
+
|
|
620
|
+
What is always true:
|
|
621
|
+
· Publish the BUILT folder (index.html inside), never the source.
|
|
622
|
+
· Solid# never pulls from GitHub. A change reaches the live app only when a publish runs.
|
|
623
|
+
· The live address is https://<company>.solidhost.app/<name>/ — "solid app get <name>" prints it.
|
|
624
|
+
· A private repository works; nothing has to be made public and GitHub Pages is not needed.
|
|
625
|
+
· Static files only. Asset paths must be relative (Vite: base: './').
|
|
626
|
+
· The app does not run on a *.solidnumber.com page. Link to its address with a button.
|
|
627
|
+
· Every version is kept: solid app rollback <name> <version> --confirm
|
|
628
|
+
· "solid app get <name>" says which commit is live. Compare commits, never file names.
|
|
629
|
+
· The publish reply names every outside address the build depends on. Fix the personal
|
|
630
|
+
and preview ones (github.io, figma.site, vercel.app…) before calling it done.
|
|
631
|
+
· To send what a visitor enters into the business's CRM, use the code under "send_a_lead"
|
|
632
|
+
in the publish reply exactly. It needs no key and works only from the app's own address.
|
|
633
|
+
· The owner wants to look first: add --hold (one publish) or --review (every push). The
|
|
634
|
+
build is kept, not live, until: solid app rollback <name> <version> --confirm
|
|
635
|
+
· Never write to Solid# to ask how this works. Run the command; the reply says what to do next.
|
|
636
|
+
`);
|
|
342
637
|
//# sourceMappingURL=app.js.map
|