Files
spacesopsandCursor 073344d4d1
Build Service / BuildPackage (push) Canceled after 0s
0.3.0:1
Group Actions and Config by category (Space-CLI, Bitcoin, Spaced,
Subspaces, Certrelay, Nacho) and build x86 + arm only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 03:34:34 -04:00

60 lines
1.7 KiB
TypeScript

import { actionGroups } from '../actionGroups'
import { i18n } from '../i18n'
import { sdk } from '../sdk'
import { dataDir, SUBSPACES_DIR } from '../utils'
export const resetSubspacesState = sdk.Action.withoutInput(
// id
'reset-subspaces-state',
// metadata
async ({ effects }) => ({
name: i18n('Reset Subspaces State'),
description: i18n(
'Wipe /data/subspaces so the next start re-creates empty Subspaces data, prover, and registry directories.',
),
warning: i18n(
'This deletes all local Subspaces state — any handles/proofs stored on disk will be lost. The binaries ship in the image, so nothing needs to be re-downloaded. The spaces wallet on spaced is preserved.',
),
allowedStatuses: 'any',
group: actionGroups.subspaces,
visibility: 'enabled',
}),
// run
async ({ effects }) => {
const res = await sdk.SubContainer.withTemp(
effects,
{ imageId: 'subspaces' },
sdk.Mounts.of().mountVolume({
volumeId: 'main',
subpath: null,
mountpoint: dataDir,
readonly: false,
}),
'spaces-reset-subspaces',
(subc) => subc.exec(['rm', '-rf', SUBSPACES_DIR], { user: 'root' }),
)
if (res.exitCode !== 0) {
return {
version: '1',
title: i18n('Failure'),
message: i18n('Could not wipe Subspaces state: ${error}', {
error: (res.stderr ?? '').toString() || `exit ${res.exitCode}`,
}),
result: null,
}
}
return {
version: '1',
title: i18n('Success'),
message: i18n(
'Subspaces cache and data have been wiped. Start (or restart) the service to re-fetch and rebuild from GitHub.',
),
result: null,
}
},
)