@nocode-factory/sanity-kit 2.61.1 → 2.62.0-rc.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocode-factory/sanity-kit",
3
- "version": "2.61.1",
3
+ "version": "2.62.0-rc.0",
4
4
  "description": "Outils Studio de NoCode Factory : Pages (liste + board), Composants, Historique",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -10,8 +10,27 @@ export interface KitUpdate {
10
10
  latest: string | null
11
11
  /** Vrai seulement quand une version stable dépasse celle qui s'exécute. */
12
12
  available: boolean
13
- /** Commande à lancer, prête à copier. */
13
+ /** Commande de mise à jour (la seule qui affiche ce qu'il reste à brancher). */
14
14
  command: string
15
+ /**
16
+ * Consigne complète à coller dans Claude Code : mise à jour, branchements listés,
17
+ * corrections signalées par doctor (`_type` compris), déploiement du Studio,
18
+ * préprod. Ce que copie le bouton : une seule action pour l'équipe.
19
+ */
20
+ prompt: string
21
+ }
22
+
23
+ export const UPGRADE_COMMAND = `npx -y ${PACKAGE}@latest upgrade`
24
+
25
+ /** Consigne copiée par le bouton de mise à jour (testée : test/kit-update.test.ts). */
26
+ export function upgradePrompt(latest: string | null): string {
27
+ return [
28
+ `Update the NCF kit (${PACKAGE}) on this project${latest ? ` to ${latest}` : ''}:`,
29
+ `1. From studio/, run \`${UPGRADE_COMMAND}\` (never a plain npm install: it shows nothing of what is left to do).`,
30
+ `2. Wire everything it lists under "À brancher dans le projet", taking the code from the starter (nocode-factory/sanity-next-starter).`,
31
+ `3. Fix every ✖ reported by \`npx ncf-kit doctor\` until there are none (list items without _type: \`npx ncf-kit item-types\`, then \`--apply\`).`,
32
+ `4. Typecheck and build web/, deploy the Studio (\`npm run deploy\` in studio/), push a branch to preprod (not main), then tell me in plain words what changed and what to check.`,
33
+ ].join('\n')
15
34
  }
16
35
 
17
36
  /**
@@ -51,6 +70,7 @@ export function useKitUpdate(): KitUpdate {
51
70
  current: KIT_VERSION,
52
71
  latest,
53
72
  available,
54
- command: `npm install ${PACKAGE}@${latest ?? 'latest'}`,
73
+ command: UPGRADE_COMMAND,
74
+ prompt: upgradePrompt(latest),
55
75
  }
56
76
  }
package/src/index.ts CHANGED
@@ -400,7 +400,7 @@ export type {CodeEmbedTypeOptions} from './form/codeEmbedType'
400
400
  export {CodeEditorInput, codeEditorInput} from './form/CodeEditorInput'
401
401
  export type {CodeLanguage} from './form/CodeEditorInput'
402
402
  export {CodeEmbedInput} from './form/CodeEmbedInput'
403
- export {useKitUpdate} from './hooks/useKitUpdate'
403
+ export {useKitUpdate, upgradePrompt, UPGRADE_COMMAND} from './hooks/useKitUpdate'
404
404
  export type {KitUpdate} from './hooks/useKitUpdate'
405
405
  export {compareVersions, isPrerelease} from './lib/version'
406
406
  export {SharePreview} from './tools/pages/SharePreview'
@@ -14,8 +14,8 @@ const CHANGELOG = 'https://github.com/nocode-factory/ncf-sanity-kit/blob/main/do
14
14
  *
15
15
  * **Il ne met pas à jour.** Un Studio tourne dans un navigateur : il ne peut
16
16
  * ni installer un paquet sur le poste d'un développeur, ni se redéployer. Ce
17
- * bouton dit ce qui manque et donne la commande — prétendre faire plus serait
18
- * mentir sur ce qui se passe.
17
+ * bouton dit ce qui manque et copie la consigne complète à donner à Claude Code
18
+ * (mise à jour, branchements, corrections, déploiement) : une seule action.
19
19
  *
20
20
  * Invisible tant que le kit est à jour : un bouton permanent qui ne dit rien
21
21
  * finit par ne plus être lu.
@@ -28,7 +28,7 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
28
28
 
29
29
  const copy = async () => {
30
30
  try {
31
- await navigator.clipboard.writeText(update.command)
31
+ await navigator.clipboard.writeText(update.prompt)
32
32
  setCopied(true)
33
33
  } catch {
34
34
  // Presse-papiers refusé : la commande reste sélectionnable à la main.
@@ -42,11 +42,12 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
42
42
  trigger={({toggle}) => (
43
43
  <Button
44
44
  mode="bleed"
45
- tone="primary"
45
+ tone="critical"
46
46
  fontSize={1}
47
47
  padding={props.inline ? 2 : 3}
48
48
  icon={ArrowUpIcon}
49
- text={`Kit ${update.latest}`}
49
+ // Rouge et gras : une mise à jour en attente doit se voir.
50
+ text={<span style={{fontWeight: 700}}>{`Kit ${update.latest}`}</span>}
50
51
  title={`A newer version of the kit is available (you are running ${update.current})`}
51
52
  justify={props.inline ? undefined : 'flex-start'}
52
53
  onClick={toggle}
@@ -65,19 +66,20 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
65
66
  </Stack>
66
67
 
67
68
  <Card padding={2} radius={2} style={{border: `1px solid ${BORDER}`}}>
68
- <Text size={0} style={{...MONO, wordBreak: 'break-all'}}>
69
- {update.command}
69
+ <Text size={0} style={{...MONO, whiteSpace: 'pre-wrap', wordBreak: 'break-word', maxHeight: 160, overflowY: 'auto', display: 'block'}}>
70
+ {update.prompt}
70
71
  </Text>
71
72
  </Card>
72
73
 
73
74
  <Flex gap={2} wrap="wrap">
74
75
  <Button
75
76
  mode="default"
76
- tone="primary"
77
+ tone="critical"
77
78
  fontSize={1}
78
79
  padding={2}
79
80
  icon={copied ? CheckmarkIcon : CopyIcon}
80
- text={copied ? 'Copied' : 'Copy command'}
81
+ // Libellé versionné (« Copy Kit 2.62.0 ») ; copie la consigne pour Claude Code.
82
+ text={<span style={{fontWeight: 700}}>{copied ? 'Copied' : `Copy Kit ${update.latest}`}</span>}
81
83
  onClick={copy}
82
84
  />
83
85
  <Button
@@ -94,9 +96,9 @@ export function NcfKitUpdate(props: {inline?: boolean}) {
94
96
 
95
97
  <Box style={{borderTop: `1px solid ${BORDER}`, paddingTop: 10}}>
96
98
  <Text size={0} muted>
97
- Run it in <code>studio/</code> then <code>web/</code>, followed by{' '}
98
- <code>npx sanity deploy</code>. The Studio cannot do it itself: it runs in your
99
- browser, not on the machine that builds it.
99
+ Paste it into Claude Code, opened on this project: it updates the kit, wires what
100
+ the project needs and redeploys the Studio. The Studio cannot do it itself: it runs
101
+ in your browser, not on the machine that builds it.
100
102
  </Text>
101
103
  </Box>
102
104
  </Stack>
package/src/version.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * quelle version. Recopiée de `package.json` par `npm version` (scripts/sync-version.mjs) ; un test
4
4
  * le vérifie.
5
5
  */
6
- export const KIT_VERSION = '2.61.1'
6
+ export const KIT_VERSION = '2.62.0-rc.0'