@solidactions/cli 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -1
- package/dist/commands/ai-examples.js +12 -3
- package/dist/commands/dev.js +11 -2
- package/dist/commands/device-login.js +5 -3
- package/dist/commands/init.js +5 -1
- package/dist/commands/login.js +1 -1
- package/dist/utils/api.js +1 -1
- package/dist/utils/examples-ref.js +34 -0
- package/dist/utils/skills.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -311,6 +311,25 @@ first three in one command.
|
|
|
311
311
|
surface — array query-param serialization and the proxy-managed header
|
|
312
312
|
filter both have fixture-backed tests under `tests/fixtures/`).
|
|
313
313
|
3. **Init smoke** — `npm run smoke:init` scaffolds a project end to end.
|
|
314
|
+
|
|
315
|
+
It serves template content from local `solidactions-examples` /
|
|
316
|
+
`solidactions-ts-sdk` checkouts, discovered beside your `solidactions-cli`
|
|
317
|
+
checkout (override with `SOLIDACTIONS_EXAMPLES_DIR` /
|
|
318
|
+
`SOLIDACTIONS_SDK_DIR`). Files are read from git **at the ref the CLI pins
|
|
319
|
+
to**, not from the checkout's working tree, so the branch a sibling happens
|
|
320
|
+
to be parked on does not affect the result; a pinned ref the checkout lacks
|
|
321
|
+
is fetched on demand.
|
|
322
|
+
|
|
323
|
+
**If a checkout is missing, the smoke SKIPs with a notice and exits 0** so a
|
|
324
|
+
clean clone can still run `check:release`. That means a local green does not
|
|
325
|
+
by itself prove the smoke ran. Set `SOLIDACTIONS_SMOKE_REQUIRE_SOURCES=1` to
|
|
326
|
+
turn a missing checkout back into a hard failure — CI's `release-candidate`
|
|
327
|
+
job sets it, so the release gate can never be skipped silently. Use it
|
|
328
|
+
locally too when you are verifying a release:
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
SOLIDACTIONS_SMOKE_REQUIRE_SOURCES=1 npm run check:release
|
|
332
|
+
```
|
|
314
333
|
4. **oauth-actions smoke** — `bash scripts/smoke.sh` exercises
|
|
315
334
|
`oauth-actions list|search|show` (plus the 404 path) against a real local
|
|
316
335
|
stub server, so it needs no credentials:
|
|
@@ -335,7 +354,18 @@ first three in one command.
|
|
|
335
354
|
`src/utils/sdk-version.ts`), so bumping that dependency moves the docs ref
|
|
336
355
|
with it — nothing to update by hand. `tests/sdk-docs-ref.test.ts` fails if
|
|
337
356
|
the declared range has no explicit minimum version to derive from.
|
|
338
|
-
6. **
|
|
357
|
+
6. **Examples pin** — every `solidactions-examples` fetch (`init`'s project
|
|
358
|
+
template, the installed skills, the `CLAUDE.md`/`AGENTS.md` helper content,
|
|
359
|
+
and `ai examples`) goes through `EXAMPLES_REF` in
|
|
360
|
+
`src/utils/examples-ref.ts`, so a scaffold never drifts with that repo's
|
|
361
|
+
`main`. Unlike the SDK pin above this is **not** derived — the examples repo
|
|
362
|
+
does not tag in step with the SDK — so it is a commit SHA that must be
|
|
363
|
+
bumped by hand when you want a newer template. To bump: set the constant to
|
|
364
|
+
the new commit and run `SOLIDACTIONS_SMOKE_REQUIRE_SOURCES=1 npm run
|
|
365
|
+
check:release`, which serves content at exactly that ref and so fails on a
|
|
366
|
+
bad or unreachable pin. `tests/examples-ref.test.ts` fails if any call site
|
|
367
|
+
stops passing the ref.
|
|
368
|
+
7. **Version bump** — update `package.json`, then publish. Once the publish
|
|
339
369
|
flow from PR #78 lands, the GitHub release **tag** drives the published npm
|
|
340
370
|
version (semver-guarded); the bump commit stays conventional.
|
|
341
371
|
|
|
@@ -10,14 +10,23 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
10
10
|
const prompts_1 = __importDefault(require("prompts"));
|
|
11
11
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
12
12
|
const github_1 = require("../utils/github");
|
|
13
|
+
const examples_ref_1 = require("../utils/examples-ref");
|
|
13
14
|
const markers_1 = require("../utils/markers");
|
|
15
|
+
/**
|
|
16
|
+
* Recursively download a directory from the examples repo.
|
|
17
|
+
*
|
|
18
|
+
* Every listing and fetch is pinned to EXAMPLES_REF (#86) so `ai examples`
|
|
19
|
+
* installs a consistent snapshot rather than whatever is on that repo's default
|
|
20
|
+
* branch mid-walk. Only ever called against solidactions-examples; the
|
|
21
|
+
* owner/repo parameters are structural, not a second supported source.
|
|
22
|
+
*/
|
|
14
23
|
async function downloadDirectory(owner, repo, remotePath, localPath) {
|
|
15
|
-
const contents = await (0, github_1.listRepoContents)(owner, repo, remotePath);
|
|
24
|
+
const contents = await (0, github_1.listRepoContents)(owner, repo, remotePath, examples_ref_1.EXAMPLES_REF);
|
|
16
25
|
fs_extra_1.default.ensureDirSync(localPath);
|
|
17
26
|
for (const item of contents) {
|
|
18
27
|
const localItemPath = path_1.default.join(localPath, item.name);
|
|
19
28
|
if (item.type === 'file') {
|
|
20
|
-
const content = await (0, github_1.fetchRawFile)(owner, repo, `${remotePath}/${item.name}
|
|
29
|
+
const content = await (0, github_1.fetchRawFile)(owner, repo, `${remotePath}/${item.name}`, examples_ref_1.EXAMPLES_REF);
|
|
21
30
|
fs_1.default.writeFileSync(localItemPath, content, 'utf8');
|
|
22
31
|
}
|
|
23
32
|
else if (item.type === 'dir') {
|
|
@@ -29,7 +38,7 @@ async function aiExamples(names, options = {}) {
|
|
|
29
38
|
try {
|
|
30
39
|
console.log(chalk_1.default.blue('Discovering available examples...'));
|
|
31
40
|
// Discover available examples
|
|
32
|
-
const repoContents = await (0, github_1.listRepoContents)('SolidActions', 'solidactions-examples');
|
|
41
|
+
const repoContents = await (0, github_1.listRepoContents)('SolidActions', 'solidactions-examples', '', examples_ref_1.EXAMPLES_REF);
|
|
33
42
|
const availableExamples = repoContents.filter((item) => item.type === 'dir' && !item.name.startsWith('.'));
|
|
34
43
|
if (availableExamples.length === 0) {
|
|
35
44
|
console.log(chalk_1.default.yellow('No examples found in the repository.'));
|
package/dist/commands/dev.js
CHANGED
|
@@ -667,7 +667,13 @@ function hasTsLoader() {
|
|
|
667
667
|
function reexecUnderTsx(file, env, input, projectDir) {
|
|
668
668
|
// dist/src/commands/dev.js → CLI entry is dist/index.js (two dirs up).
|
|
669
669
|
const cliEntry = path_1.default.resolve(__dirname, '..', 'index.js');
|
|
670
|
-
|
|
670
|
+
// This function sets the child's cwd to projectDir, so the entry MUST be
|
|
671
|
+
// absolute by the time it is forwarded — a relative path would resolve
|
|
672
|
+
// against the parent's cwd here and the child's cwd there, yielding a
|
|
673
|
+
// doubled path when the run started outside the project root (#85).
|
|
674
|
+
// Resolved against the caller's cwd, which is still current.
|
|
675
|
+
const entry = path_1.default.resolve(file);
|
|
676
|
+
const args = ['tsx', cliEntry, 'dev', entry, '--input', input];
|
|
671
677
|
if (env) {
|
|
672
678
|
args.push('--env', env);
|
|
673
679
|
}
|
|
@@ -728,7 +734,10 @@ async function dev(file, options) {
|
|
|
728
734
|
process.exit(1);
|
|
729
735
|
}
|
|
730
736
|
}
|
|
731
|
-
|
|
737
|
+
// Forward the RESOLVED path, not the original argument: the child's cwd
|
|
738
|
+
// is projectDir, so a relative arg would be resolved a second time
|
|
739
|
+
// against a different directory (#85).
|
|
740
|
+
process.exit(reexecUnderTsx(filePath, env, input, projectDir));
|
|
732
741
|
}
|
|
733
742
|
// In-process path (already under a TS loader, or a .js/.mjs entry).
|
|
734
743
|
let result;
|
|
@@ -76,11 +76,13 @@ async function deviceLogin(options) {
|
|
|
76
76
|
const host = resolved.host;
|
|
77
77
|
console.log(chalk_1.default.blue('Requesting device authorization...'));
|
|
78
78
|
const code = await requestDeviceCode(host);
|
|
79
|
-
|
|
79
|
+
// Deliberately the bare verification_uri, never verification_uri_complete:
|
|
80
|
+
// the server ignores prefilled codes (phishing defense) — the user types
|
|
81
|
+
// the code shown here.
|
|
80
82
|
console.log('');
|
|
81
83
|
console.log(chalk_1.default.green('To finish signing in, visit:'));
|
|
82
|
-
console.log(' ' + chalk_1.default.blue.underline(
|
|
83
|
-
console.log(chalk_1.default.gray('
|
|
84
|
+
console.log(' ' + chalk_1.default.blue.underline(code.verification_uri));
|
|
85
|
+
console.log(chalk_1.default.gray(' and enter code: ') + chalk_1.default.bold(code.user_code));
|
|
84
86
|
console.log('');
|
|
85
87
|
console.log(chalk_1.default.gray('Waiting for approval in your browser...'));
|
|
86
88
|
let token;
|
package/dist/commands/init.js
CHANGED
|
@@ -10,6 +10,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
10
10
|
const chalk_1 = __importDefault(require("chalk"));
|
|
11
11
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
12
12
|
const github_1 = require("../utils/github");
|
|
13
|
+
const examples_ref_1 = require("../utils/examples-ref");
|
|
13
14
|
const ai_init_1 = require("./ai-init");
|
|
14
15
|
const EXAMPLES_OWNER = 'SolidActions';
|
|
15
16
|
const EXAMPLES_REPO = 'solidactions-examples';
|
|
@@ -68,7 +69,10 @@ async function init(directory, options = {}) {
|
|
|
68
69
|
console.log(chalk_1.default.blue(`Scaffolding "${projectName}" in ${targetDir}...`));
|
|
69
70
|
for (const [remoteSuffix, localSuffix] of exports.TEMPLATE_FILES) {
|
|
70
71
|
const remotePath = `${TEMPLATE_PREFIX}/${remoteSuffix}`;
|
|
71
|
-
|
|
72
|
+
// Pinned to EXAMPLES_REF: unpinned, this loop scaffolded whatever
|
|
73
|
+
// was on the examples repo's default branch — including the
|
|
74
|
+
// @solidactions/sdk version the new project declares (#86).
|
|
75
|
+
let content = await (0, github_1.fetchRawFile)(EXAMPLES_OWNER, EXAMPLES_REPO, remotePath, examples_ref_1.EXAMPLES_REF);
|
|
72
76
|
content = content.replace(/__PROJECT_NAME__/g, projectName);
|
|
73
77
|
const outPath = path_1.default.join(targetDir, localSuffix);
|
|
74
78
|
fs_extra_1.default.ensureDirSync(path_1.default.dirname(outPath));
|
package/dist/commands/login.js
CHANGED
|
@@ -123,7 +123,7 @@ async function selectWorkspaceInteractively(workspaces) {
|
|
|
123
123
|
console.log(chalk_1.default.gray(`Auto-selected workspace: ${workspaces[0].name}`));
|
|
124
124
|
return workspaces[0];
|
|
125
125
|
}
|
|
126
|
-
console.log(chalk_1.default.blue('\nSelect
|
|
126
|
+
console.log(chalk_1.default.blue('\nSelect your default workspace (change anytime with `solidactions workspace set`):\n'));
|
|
127
127
|
workspaces.forEach((ws, i) => {
|
|
128
128
|
console.log(` ${chalk_1.default.white(`${i + 1}.`)} ${ws.name}`);
|
|
129
129
|
});
|
package/dist/utils/api.js
CHANGED
|
@@ -199,7 +199,7 @@ async function ensureWorkspaceSelected(config) {
|
|
|
199
199
|
console.log(chalk_1.default.gray(`Auto-selected workspace: ${selected.name}`));
|
|
200
200
|
}
|
|
201
201
|
else {
|
|
202
|
-
console.log(chalk_1.default.blue('\nSelect
|
|
202
|
+
console.log(chalk_1.default.blue('\nSelect your default workspace (change anytime with `solidactions workspace set`):\n'));
|
|
203
203
|
workspaces.forEach((ws, i) => {
|
|
204
204
|
console.log(` ${chalk_1.default.white(`${i + 1}.`)} ${ws.name} ${chalk_1.default.gray(`(${ws.org_name}, ${ws.role})`)}`);
|
|
205
205
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EXAMPLES_REF = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The git ref used for every fetch from the solidactions-examples repo:
|
|
6
|
+
* `init`'s project template (TEMPLATE_FILES) and the AI skills / helper content
|
|
7
|
+
* installed alongside it.
|
|
8
|
+
*
|
|
9
|
+
* These fetches previously defaulted to `main`, so the scaffold a user got —
|
|
10
|
+
* including the `@solidactions/sdk` version their new project depends on — was
|
|
11
|
+
* whatever happened to be on that repo's default branch at that moment. That is
|
|
12
|
+
* the same unpinned-fetch class as the SDK docs fetch fixed in #39; see
|
|
13
|
+
* {@link ./sdk-version.ts}.
|
|
14
|
+
*
|
|
15
|
+
* WHY A COMMIT SHA AND NOT A TAG: the SDK pin derives its ref from this CLI's
|
|
16
|
+
* declared `@solidactions/sdk` range, because the SDK repo tags `vX.Y.Z` in step
|
|
17
|
+
* with the package it publishes. solidactions-examples does NOT version in
|
|
18
|
+
* lockstep with the SDK — its newest tag (v0.7.0) predates the current template
|
|
19
|
+
* by a wide margin: it declares `@solidactions/sdk` ^0.6.0 (this CLI declares
|
|
20
|
+
* ^0.7.3) and lacks skills/solidactions-crew-skills.md entirely. Pinning to that
|
|
21
|
+
* tag would regress every new scaffold, so the same derived-version scheme cannot
|
|
22
|
+
* apply here. A commit SHA is immutable and gives the property that actually
|
|
23
|
+
* matters — the scaffold no longer moves under us.
|
|
24
|
+
*
|
|
25
|
+
* TO UPDATE: point this at the new solidactions-examples commit and re-run
|
|
26
|
+
* `npm run check:release`; smoke:init serves template content at exactly this
|
|
27
|
+
* ref, so a bad or unreachable SHA fails the release check rather than reaching
|
|
28
|
+
* users. If solidactions-examples ever starts publishing tags in step with the
|
|
29
|
+
* SDK, replace this with a derivation the way sdk-version.ts does.
|
|
30
|
+
*
|
|
31
|
+
* Currently: solidactions-examples main @ 3ca5fd4 "docs: publish examples and AI
|
|
32
|
+
* skill guidance (#23)".
|
|
33
|
+
*/
|
|
34
|
+
exports.EXAMPLES_REF = '3ca5fd4d3107659b27889775791f6691cf173303';
|
package/dist/utils/skills.js
CHANGED
|
@@ -12,6 +12,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
12
12
|
const path_1 = __importDefault(require("path"));
|
|
13
13
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
14
14
|
const github_1 = require("./github");
|
|
15
|
+
const examples_ref_1 = require("./examples-ref");
|
|
15
16
|
exports.SOLIDACTIONS_SKILL_NAMES = [
|
|
16
17
|
'solidactions-getting-started',
|
|
17
18
|
'solidactions-workflow-coding',
|
|
@@ -47,7 +48,7 @@ async function installSkills(targetDir) {
|
|
|
47
48
|
fs_extra_1.default.ensureDirSync(targetDir);
|
|
48
49
|
for (const skillName of exports.SOLIDACTIONS_SKILL_NAMES) {
|
|
49
50
|
const remotePath = `${SKILLS_PATH_PREFIX}/${skillName}.md`;
|
|
50
|
-
const content = await (0, github_1.fetchRawFile)(EXAMPLES_OWNER, EXAMPLES_REPO, remotePath);
|
|
51
|
+
const content = await (0, github_1.fetchRawFile)(EXAMPLES_OWNER, EXAMPLES_REPO, remotePath, examples_ref_1.EXAMPLES_REF);
|
|
51
52
|
const filePath = path_1.default.join(targetDir, `${skillName}.md`);
|
|
52
53
|
fs_1.default.writeFileSync(filePath, content, 'utf8');
|
|
53
54
|
written.push(filePath);
|
|
@@ -59,7 +60,7 @@ async function installSkills(targetDir) {
|
|
|
59
60
|
* repo. Single source per target — no legacy fallback.
|
|
60
61
|
*/
|
|
61
62
|
async function fetchAiHelperContent(targetFile) {
|
|
62
|
-
return (0, github_1.fetchRawFile)(EXAMPLES_OWNER, EXAMPLES_REPO, targetFile);
|
|
63
|
+
return (0, github_1.fetchRawFile)(EXAMPLES_OWNER, EXAMPLES_REPO, targetFile, examples_ref_1.EXAMPLES_REF);
|
|
63
64
|
}
|
|
64
65
|
/**
|
|
65
66
|
* True when the project dir already has SolidActions skill files installed
|