@sanity/runtime-cli 17.2.0-next.ga4b9ae7 → 17.3.0-blueprinit.gaf4f184

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.
Files changed (41) hide show
  1. package/README.md +35 -26
  2. package/SKILL.md +21 -0
  3. package/dist/actions/blueprinit/manifest.d.ts +13 -0
  4. package/dist/actions/blueprinit/manifest.js +57 -0
  5. package/dist/actions/blueprinit/studio.d.ts +6 -0
  6. package/dist/actions/blueprinit/studio.js +43 -0
  7. package/dist/actions/blueprinit/templates.d.ts +34 -0
  8. package/dist/actions/blueprinit/templates.js +83 -0
  9. package/dist/actions/blueprinit/workspace.d.ts +15 -0
  10. package/dist/actions/blueprinit/workspace.js +142 -0
  11. package/dist/actions/sanity/datasets.d.ts +15 -0
  12. package/dist/actions/sanity/datasets.js +26 -0
  13. package/dist/baseCommands.d.ts +7 -0
  14. package/dist/baseCommands.js +21 -0
  15. package/dist/commands/blueprinit.d.ts +14 -0
  16. package/dist/commands/blueprinit.js +45 -0
  17. package/dist/commands/functions/env/add.d.ts +3 -0
  18. package/dist/commands/functions/env/add.js +6 -2
  19. package/dist/commands/functions/env/list.d.ts +3 -0
  20. package/dist/commands/functions/env/list.js +9 -3
  21. package/dist/commands/functions/env/remove.d.ts +3 -0
  22. package/dist/commands/functions/env/remove.js +9 -3
  23. package/dist/cores/blueprinit/adopt.d.ts +6 -0
  24. package/dist/cores/blueprinit/adopt.js +90 -0
  25. package/dist/cores/blueprinit/finish.d.ts +14 -0
  26. package/dist/cores/blueprinit/finish.js +36 -0
  27. package/dist/cores/blueprinit/fresh.d.ts +3 -0
  28. package/dist/cores/blueprinit/fresh.js +88 -0
  29. package/dist/cores/blueprinit/prompts.d.ts +4 -0
  30. package/dist/cores/blueprinit/prompts.js +14 -0
  31. package/dist/cores/blueprinit/selection.d.ts +15 -0
  32. package/dist/cores/blueprinit/selection.js +63 -0
  33. package/dist/cores/blueprinit/types.d.ts +13 -0
  34. package/dist/cores/blueprinit/types.js +1 -0
  35. package/dist/cores/blueprinit.d.ts +7 -0
  36. package/dist/cores/blueprinit.js +39 -0
  37. package/dist/utils/command-skills.d.ts +2 -0
  38. package/dist/utils/command-skills.js +17 -0
  39. package/oclif.manifest.json +1263 -957
  40. package/package.json +5 -3
  41. package/skills/blueprinit.md +137 -0
@@ -0,0 +1,7 @@
1
+ import type { BlueprinitFlags } from './blueprinit/types.js';
2
+ import type { CoreConfig, CoreResult } from './index.js';
3
+ export interface BlueprinitOptions extends CoreConfig {
4
+ dir?: string;
5
+ flags?: BlueprinitFlags;
6
+ }
7
+ export declare function blueprinitCore(options: BlueprinitOptions): Promise<CoreResult>;
@@ -0,0 +1,39 @@
1
+ import { cwd } from 'node:process';
2
+ import { detectStudio } from '../actions/blueprinit/studio.js';
3
+ import { findBlueprintFile } from '../actions/blueprints/blueprint.js';
4
+ import { validTokenOrErrorMessage } from '../utils/validated-token.js';
5
+ import { adoptFlow } from './blueprinit/adopt.js';
6
+ import { freshFlow } from './blueprinit/fresh.js';
7
+ export async function blueprinitCore(options) {
8
+ const { bin, log, flags = {}, dir = cwd() } = options;
9
+ try {
10
+ const existingBlueprint = findBlueprintFile(dir);
11
+ if (existingBlueprint) {
12
+ log(`A blueprint already exists here (${existingBlueprint.fileName}).`);
13
+ log('');
14
+ log('Use these instead:');
15
+ log(` npx ${bin} blueprints config --edit`);
16
+ log(` npx ${bin} blueprints doctor`);
17
+ return {
18
+ success: true,
19
+ json: { alreadyInitialized: true, blueprintFile: existingBlueprint.fileName },
20
+ };
21
+ }
22
+ const tokenCheck = await validTokenOrErrorMessage(log);
23
+ if (!tokenCheck.ok) {
24
+ return {
25
+ success: false,
26
+ error: 'No Sanity session found.',
27
+ suggestions: ['Sign in first: npx sanity login', 'Then run blueprinit again.'],
28
+ };
29
+ }
30
+ log('Setting up your Sanity workspace.');
31
+ log('');
32
+ const flowOptions = { bin, dir, flags, log, token: tokenCheck.value };
33
+ const studio = detectStudio(dir);
34
+ return studio ? await adoptFlow({ ...flowOptions, studio }) : await freshFlow(flowOptions);
35
+ }
36
+ catch (error) {
37
+ return { success: false, error: error instanceof Error ? error.message : String(error) };
38
+ }
39
+ }
@@ -0,0 +1,2 @@
1
+ export declare function commandSkillFilename(commandId: string): string;
2
+ export declare function readCommandSkill(commandId: string, skillsDirectory?: string): Promise<string | undefined>;
@@ -0,0 +1,17 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const SKILLS_DIRECTORY = fileURLToPath(new URL('../../skills/', import.meta.url));
5
+ export function commandSkillFilename(commandId) {
6
+ return `${commandId.replaceAll(':', '-')}.md`;
7
+ }
8
+ export async function readCommandSkill(commandId, skillsDirectory = SKILLS_DIRECTORY) {
9
+ try {
10
+ return await readFile(join(skillsDirectory, commandSkillFilename(commandId)), 'utf8');
11
+ }
12
+ catch (error) {
13
+ if (error.code === 'ENOENT')
14
+ return;
15
+ throw error;
16
+ }
17
+ }