@embeddables/cli 0.7.9 → 0.7.10

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.
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAwHA,wBAAsB,OAAO,CAAC,IAAI,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,iBAyOxE"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAwHA,wBAAsB,OAAO,CAAC,IAAI,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,iBAgPxE"}
@@ -194,6 +194,12 @@ export async function runInit(opts) {
194
194
  else {
195
195
  stdout.print(pc.gray(' ✓ embeddables/ directory exists'));
196
196
  }
197
+ // Remove old .claudefiles folder (replaced by .cursor/ and .claude/)
198
+ const claudefilesDir = path.join(cwd, '.claudefiles');
199
+ if (fs.existsSync(claudefilesDir)) {
200
+ fs.rmSync(claudefilesDir, { recursive: true });
201
+ stdout.print(pc.green(' ✓ Removed old .claudefiles/'));
202
+ }
197
203
  // Inject .cursor/ and .claude/ from source .prompts/embeddables-cli.md (or copy if pre-built dirs exist)
198
204
  const packageRoot = path.resolve(__dirname, '..', '..');
199
205
  const promptsSource = path.join(packageRoot, '.prompts', 'embeddables-cli.md');
@@ -1 +1 @@
1
- {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AA6HA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6GAA6G;IAC7G,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,iHAAiH;IACjH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,iBA+SjD"}
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/commands/pull.ts"],"names":[],"mappings":"AA6HA,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6GAA6G;IAC7G,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,iHAAiH;IACjH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,iBAgTjD"}
@@ -156,6 +156,7 @@ export async function runPull(opts) {
156
156
  stdout.print(pc.cyan('Fetching embeddables from project...'));
157
157
  const selected = await promptForEmbeddable(projectId, {
158
158
  message: 'Select an embeddable to pull:',
159
+ prioritizeLocal: true,
159
160
  });
160
161
  if (!selected) {
161
162
  logger.error('embeddable selection failed');
@@ -14,6 +14,8 @@ export interface LocalEmbeddable {
14
14
  export interface PromptForEmbeddableOptions {
15
15
  /** Custom message for the prompt */
16
16
  message?: string;
17
+ /** When true, sort so embeddables already present in embeddables/ appear first */
18
+ prioritizeLocal?: boolean;
17
19
  }
18
20
  /**
19
21
  * Fetch all embeddables for a project from Supabase
@@ -1 +1 @@
1
- {"version":3,"file":"embeddables.d.ts","sourceRoot":"","sources":["../../src/prompts/embeddables.ts"],"names":[],"mappings":"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QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,0BAA0B;IACzC,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kFAAkF;IAClF,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CA0B1F;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA2BpC;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4ExB;AAED;;GAEG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC,CAqC3E;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuCxB"}
@@ -67,29 +67,64 @@ export async function fetchEmbeddableMetadata(embeddableId) {
67
67
  * Returns null if no embeddables found or user cancels
68
68
  */
69
69
  export async function promptForEmbeddable(projectId, options = {}) {
70
- const { message = 'Select an embeddable:' } = options;
71
- const embeddables = await fetchProjectEmbeddables(projectId);
70
+ const { message = 'Select an embeddable:', prioritizeLocal = false } = options;
71
+ let embeddables = await fetchProjectEmbeddables(projectId);
72
+ const SEPARATOR_VALUE = '__separator__';
73
+ let inRepo = [];
74
+ let notInRepo = [];
75
+ if (prioritizeLocal && embeddables.length > 0) {
76
+ const local = await discoverLocalEmbeddables();
77
+ const localIds = new Set(local.map((e) => e.id));
78
+ inRepo = embeddables.filter((e) => localIds.has(e.id));
79
+ notInRepo = embeddables.filter((e) => !localIds.has(e.id));
80
+ embeddables = [...inRepo, ...notInRepo];
81
+ }
72
82
  if (embeddables.length === 0) {
73
83
  stdout.print(pc.yellow('No embeddables found in this project.'));
74
84
  return null;
75
85
  }
86
+ const hasTwoSections = prioritizeLocal && inRepo.length > 0 && notInRepo.length > 0;
87
+ const separatorChoice = {
88
+ title: pc.dim('── Other embeddables in project ──'),
89
+ value: SEPARATOR_VALUE,
90
+ disabled: true,
91
+ };
76
92
  const choices = embeddables.map((e) => ({
77
93
  title: e.title || e.id,
78
94
  description: e.id,
79
95
  value: e.id,
80
96
  }));
97
+ if (hasTwoSections) {
98
+ choices.splice(inRepo.length, 0, separatorChoice);
99
+ }
81
100
  const response = await prompts({
82
101
  type: 'autocomplete',
83
102
  name: 'id',
84
103
  message,
85
104
  choices,
86
- suggest: (input, choices) => Promise.resolve(choices.filter((c) => (c.title?.toLowerCase().includes(input.toLowerCase()) ?? false) ||
87
- String(c.value).toLowerCase().includes(input.toLowerCase()))),
105
+ suggest: (input, list) => {
106
+ const realChoices = list.filter((c) => c.value !== SEPARATOR_VALUE);
107
+ const filtered = input
108
+ ? realChoices.filter((c) => (c.title?.toLowerCase().includes(input.toLowerCase()) ?? false) ||
109
+ String(c.value).toLowerCase().includes(input.toLowerCase()))
110
+ : realChoices;
111
+ if (hasTwoSections && !input) {
112
+ return Promise.resolve([
113
+ ...filtered.slice(0, inRepo.length),
114
+ separatorChoice,
115
+ ...filtered.slice(inRepo.length),
116
+ ]);
117
+ }
118
+ return Promise.resolve(filtered);
119
+ },
88
120
  }, {
89
121
  onCancel: () => {
90
122
  process.exit(0);
91
123
  },
92
124
  });
125
+ if (response.id === SEPARATOR_VALUE) {
126
+ return promptForEmbeddable(projectId, options);
127
+ }
93
128
  return response.id || null;
94
129
  }
95
130
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddables/cli",
3
- "version": "0.7.9",
3
+ "version": "0.7.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "embeddables": "./bin/embeddables.mjs"