@gadicc/loom 1.38.0 → 2.0.1
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/.loom-source-manifest.json +97 -0
- package/README.md +103 -31
- package/db/databaseTls.js +6 -3
- package/db/databaseUrl.js +3 -2
- package/db/drizzle-config.js +14 -16
- package/db/fixtures.d.ts +1 -3
- package/db/fixtures.js +4 -7
- package/esm/bin/loom.d.ts +2 -1
- package/esm/bin/loom.d.ts.map +1 -1
- package/esm/bin/loom.js +37 -10
- package/esm/bin/loom.js.map +1 -0
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/esm/mod.js.map +1 -0
- package/esm/src/apiKeys/authorize.d.ts.map +1 -1
- package/esm/src/apiKeys/authorize.js +15 -14
- package/esm/src/apiKeys/authorize.js.map +1 -0
- package/esm/src/apiKeys/betterAuth.d.ts.map +1 -1
- package/esm/src/apiKeys/betterAuth.js +1 -0
- package/esm/src/apiKeys/betterAuth.js.map +1 -0
- package/esm/src/apiKeys/country.d.ts.map +1 -1
- package/esm/src/apiKeys/country.js +1 -0
- package/esm/src/apiKeys/country.js.map +1 -0
- package/esm/src/apiKeys/credentials.d.ts.map +1 -1
- package/esm/src/apiKeys/credentials.js +3 -1
- package/esm/src/apiKeys/credentials.js.map +1 -0
- package/esm/src/apiKeys/fingerprint.d.ts.map +1 -1
- package/esm/src/apiKeys/fingerprint.js +1 -0
- package/esm/src/apiKeys/fingerprint.js.map +1 -0
- package/esm/src/apiKeys/lifecycle.d.ts.map +1 -1
- package/esm/src/apiKeys/lifecycle.js +1 -0
- package/esm/src/apiKeys/lifecycle.js.map +1 -0
- package/esm/src/apiKeys/limits.d.ts.map +1 -1
- package/esm/src/apiKeys/limits.js +10 -10
- package/esm/src/apiKeys/limits.js.map +1 -0
- package/esm/src/apiKeys/mod.d.ts +0 -1
- package/esm/src/apiKeys/mod.d.ts.map +1 -1
- package/esm/src/apiKeys/mod.js +1 -1
- package/esm/src/apiKeys/mod.js.map +1 -0
- package/esm/src/apiKeys/permissions.d.ts.map +1 -1
- package/esm/src/apiKeys/permissions.js +1 -0
- package/esm/src/apiKeys/permissions.js.map +1 -0
- package/esm/src/apiKeys/policy.d.ts.map +1 -1
- package/esm/src/apiKeys/policy.js +1 -0
- package/esm/src/apiKeys/policy.js.map +1 -0
- package/esm/src/apiKeys/retention.d.ts.map +1 -1
- package/esm/src/apiKeys/retention.js +1 -0
- package/esm/src/apiKeys/retention.js.map +1 -0
- package/esm/src/apiKeys/types.d.ts.map +1 -1
- package/esm/src/apiKeys/types.js +1 -0
- package/esm/src/apiKeys/types.js.map +1 -0
- package/esm/src/cli/atomicText.d.ts +3 -0
- package/esm/src/cli/atomicText.d.ts.map +1 -0
- package/esm/src/cli/atomicText.js +33 -0
- package/esm/src/cli/atomicText.js.map +1 -0
- package/esm/src/cli/bunLocalDev.d.ts +65 -0
- package/esm/src/cli/bunLocalDev.d.ts.map +1 -0
- package/esm/src/cli/bunLocalDev.js +459 -0
- package/esm/src/cli/bunLocalDev.js.map +1 -0
- package/esm/src/cli/bunProject.d.ts +30 -0
- package/esm/src/cli/bunProject.d.ts.map +1 -0
- package/esm/src/cli/bunProject.js +309 -0
- package/esm/src/cli/bunProject.js.map +1 -0
- package/esm/src/cli/cliBootstrap.d.ts +83 -0
- package/esm/src/cli/cliBootstrap.d.ts.map +1 -0
- package/esm/src/cli/cliBootstrap.js +186 -0
- package/esm/src/cli/cliBootstrap.js.map +1 -0
- package/esm/src/cli/externalSkills.d.ts.map +1 -1
- package/esm/src/cli/externalSkills.js +9 -5
- package/esm/src/cli/externalSkills.js.map +1 -0
- package/esm/src/cli/filesR2Policy.d.ts.map +1 -1
- package/esm/src/cli/filesR2Policy.js +18 -11
- package/esm/src/cli/filesR2Policy.js.map +1 -0
- package/esm/src/cli/generatedBuild.d.ts +42 -0
- package/esm/src/cli/generatedBuild.d.ts.map +1 -0
- package/esm/src/cli/generatedBuild.js +259 -0
- package/esm/src/cli/generatedBuild.js.map +1 -0
- package/esm/src/cli/generatedCleanup.d.ts +7 -0
- package/esm/src/cli/generatedCleanup.d.ts.map +1 -0
- package/esm/src/cli/generatedCleanup.js +67 -0
- package/esm/src/cli/generatedCleanup.js.map +1 -0
- package/esm/src/cli/generatedDevLease.d.ts +8 -0
- package/esm/src/cli/generatedDevLease.d.ts.map +1 -0
- package/esm/src/cli/generatedDevLease.js +39 -0
- package/esm/src/cli/generatedDevLease.js.map +1 -0
- package/esm/src/cli/generatedInstall.d.ts +64 -0
- package/esm/src/cli/generatedInstall.d.ts.map +1 -0
- package/esm/src/cli/generatedInstall.js +466 -0
- package/esm/src/cli/generatedInstall.js.map +1 -0
- package/esm/src/cli/generatedWorkflow.d.ts +34 -0
- package/esm/src/cli/generatedWorkflow.d.ts.map +1 -0
- package/esm/src/cli/generatedWorkflow.js +85 -0
- package/esm/src/cli/generatedWorkflow.js.map +1 -0
- package/esm/src/cli/legacyManagedOutputs.d.ts.map +1 -1
- package/esm/src/cli/legacyManagedOutputs.js +1 -0
- package/esm/src/cli/legacyManagedOutputs.js.map +1 -0
- package/esm/src/cli/localDb.d.ts.map +1 -1
- package/esm/src/cli/localDb.js +33 -28
- package/esm/src/cli/localDb.js.map +1 -0
- package/esm/src/cli/localDevLock.d.ts +9 -0
- package/esm/src/cli/localDevLock.d.ts.map +1 -1
- package/esm/src/cli/localDevLock.js +54 -13
- package/esm/src/cli/localDevLock.js.map +1 -0
- package/esm/src/cli/localDevPackage.d.ts +6 -11
- package/esm/src/cli/localDevPackage.d.ts.map +1 -1
- package/esm/src/cli/localDevPackage.js +51 -48
- package/esm/src/cli/localDevPackage.js.map +1 -0
- package/esm/src/cli/managedFiles.d.ts.map +1 -1
- package/esm/src/cli/managedFiles.js +34 -18
- package/esm/src/cli/managedFiles.js.map +1 -0
- package/esm/src/cli/migrationEnv.d.ts +16 -3
- package/esm/src/cli/migrationEnv.d.ts.map +1 -1
- package/esm/src/cli/migrationEnv.js +7 -4
- package/esm/src/cli/migrationEnv.js.map +1 -0
- package/esm/src/cli/mod.d.ts +19 -7
- package/esm/src/cli/mod.d.ts.map +1 -1
- package/esm/src/cli/mod.js +2010 -745
- package/esm/src/cli/mod.js.map +1 -0
- package/esm/src/cli/packageTreeSignature.d.ts +8 -0
- package/esm/src/cli/packageTreeSignature.d.ts.map +1 -0
- package/esm/src/cli/packageTreeSignature.js +60 -0
- package/esm/src/cli/packageTreeSignature.js.map +1 -0
- package/esm/src/cli/processIdentity.d.ts +7 -0
- package/esm/src/cli/processIdentity.d.ts.map +1 -0
- package/esm/src/cli/processIdentity.js +39 -0
- package/esm/src/cli/processIdentity.js.map +1 -0
- package/esm/src/cli/projectSkills.d.ts +1 -1
- package/esm/src/cli/projectSkills.d.ts.map +1 -1
- package/esm/src/cli/projectSkills.js +31 -23
- package/esm/src/cli/projectSkills.js.map +1 -0
- package/esm/src/cli/projectTooling.d.ts +6 -3
- package/esm/src/cli/projectTooling.d.ts.map +1 -1
- package/esm/src/cli/projectTooling.js +86 -41
- package/esm/src/cli/projectTooling.js.map +1 -0
- package/esm/src/cli/releaseConfig.d.ts.map +1 -1
- package/esm/src/cli/releaseConfig.js +5 -3
- package/esm/src/cli/releaseConfig.js.map +1 -0
- package/esm/src/cli/releaseCredentials.d.ts.map +1 -1
- package/esm/src/cli/releaseCredentials.js +19 -31
- package/esm/src/cli/releaseCredentials.js.map +1 -0
- package/esm/src/cli/releaseTrust.d.ts.map +1 -1
- package/esm/src/cli/releaseTrust.js +11 -4
- package/esm/src/cli/releaseTrust.js.map +1 -0
- package/esm/src/cli/releaseTrustCommand.d.ts.map +1 -1
- package/esm/src/cli/releaseTrustCommand.js +6 -4
- package/esm/src/cli/releaseTrustCommand.js.map +1 -0
- package/esm/src/cli/sourceConfig.d.ts +3 -0
- package/esm/src/cli/sourceConfig.d.ts.map +1 -0
- package/esm/src/cli/sourceConfig.js +91 -0
- package/esm/src/cli/sourceConfig.js.map +1 -0
- package/esm/src/cli/sourceDev.d.ts +77 -0
- package/esm/src/cli/sourceDev.d.ts.map +1 -0
- package/esm/src/cli/sourceDev.js +974 -0
- package/esm/src/cli/sourceDev.js.map +1 -0
- package/esm/src/cli/vercelBuildEnv.d.ts.map +1 -1
- package/esm/src/cli/vercelBuildEnv.js +21 -15
- package/esm/src/cli/vercelBuildEnv.js.map +1 -0
- package/esm/src/cli/vercelEnvMask.d.ts +2 -2
- package/esm/src/cli/vercelEnvMask.d.ts.map +1 -1
- package/esm/src/cli/vercelEnvMask.js +8 -4
- package/esm/src/cli/vercelEnvMask.js.map +1 -0
- package/esm/src/cli/vercelProjectRelease.d.ts.map +1 -1
- package/esm/src/cli/vercelProjectRelease.js +45 -22
- package/esm/src/cli/vercelProjectRelease.js.map +1 -0
- package/esm/src/cli/vercelPulledEnv.d.ts +1 -1
- package/esm/src/cli/vercelPulledEnv.d.ts.map +1 -1
- package/esm/src/cli/vercelPulledEnv.js +1 -0
- package/esm/src/cli/vercelPulledEnv.js.map +1 -0
- package/esm/src/clientData/identity.d.ts.map +1 -1
- package/esm/src/clientData/identity.js +1 -0
- package/esm/src/clientData/identity.js.map +1 -0
- package/esm/src/clientData/mod.d.ts +0 -1
- package/esm/src/clientData/mod.d.ts.map +1 -1
- package/esm/src/clientData/mod.js +1 -0
- package/esm/src/clientData/mod.js.map +1 -0
- package/esm/src/files/client.d.ts +1 -1
- package/esm/src/files/client.d.ts.map +1 -1
- package/esm/src/files/client.js +3 -4
- package/esm/src/files/client.js.map +1 -0
- package/esm/src/files/errors.d.ts.map +1 -1
- package/esm/src/files/errors.js +3 -12
- package/esm/src/files/errors.js.map +1 -0
- package/esm/src/files/hash.d.ts +1 -1
- package/esm/src/files/hash.d.ts.map +1 -1
- package/esm/src/files/hash.js +1 -0
- package/esm/src/files/hash.js.map +1 -0
- package/esm/src/files/memory.d.ts.map +1 -1
- package/esm/src/files/memory.js +2 -1
- package/esm/src/files/memory.js.map +1 -0
- package/esm/src/files/metadata.d.ts.map +1 -1
- package/esm/src/files/metadata.js +11 -18
- package/esm/src/files/metadata.js.map +1 -0
- package/esm/src/files/mod.d.ts +0 -1
- package/esm/src/files/mod.d.ts.map +1 -1
- package/esm/src/files/mod.js +1 -1
- package/esm/src/files/mod.js.map +1 -0
- package/esm/src/files/s3.d.ts.map +1 -1
- package/esm/src/files/s3.js +6 -4
- package/esm/src/files/s3.js.map +1 -0
- package/esm/src/files/service.d.ts.map +1 -1
- package/esm/src/files/service.js +3 -4
- package/esm/src/files/service.js.map +1 -0
- package/esm/src/files/types.d.ts.map +1 -1
- package/esm/src/files/types.js +1 -0
- package/esm/src/files/types.js.map +1 -0
- package/esm/src/jobs/catalog.d.ts.map +1 -1
- package/esm/src/jobs/catalog.js +5 -1
- package/esm/src/jobs/catalog.js.map +1 -0
- package/esm/src/jobs/controller.d.ts +1 -1
- package/esm/src/jobs/controller.d.ts.map +1 -1
- package/esm/src/jobs/controller.js +11 -55
- package/esm/src/jobs/controller.js.map +1 -0
- package/esm/src/jobs/direct.d.ts.map +1 -1
- package/esm/src/jobs/direct.js +3 -3
- package/esm/src/jobs/direct.js.map +1 -0
- package/esm/src/jobs/events.d.ts.map +1 -1
- package/esm/src/jobs/events.js +1 -0
- package/esm/src/jobs/events.js.map +1 -0
- package/esm/src/jobs/format.d.ts +5 -5
- package/esm/src/jobs/format.d.ts.map +1 -1
- package/esm/src/jobs/format.js +2 -1
- package/esm/src/jobs/format.js.map +1 -0
- package/esm/src/jobs/http.d.ts +3 -3
- package/esm/src/jobs/http.d.ts.map +1 -1
- package/esm/src/jobs/http.js +1 -0
- package/esm/src/jobs/http.js.map +1 -0
- package/esm/src/jobs/log.d.ts.map +1 -1
- package/esm/src/jobs/log.js +1 -0
- package/esm/src/jobs/log.js.map +1 -0
- package/esm/src/jobs/mod.d.ts.map +1 -1
- package/esm/src/jobs/mod.js +1 -0
- package/esm/src/jobs/mod.js.map +1 -0
- package/esm/src/jobs/run.d.ts.map +1 -1
- package/esm/src/jobs/run.js +1 -0
- package/esm/src/jobs/run.js.map +1 -0
- package/esm/src/jobs/sanitize.d.ts.map +1 -1
- package/esm/src/jobs/sanitize.js +1 -0
- package/esm/src/jobs/sanitize.js.map +1 -0
- package/esm/src/jobs/types.d.ts +1 -0
- package/esm/src/jobs/types.d.ts.map +1 -1
- package/esm/src/jobs/types.js +1 -0
- package/esm/src/jobs/types.js.map +1 -0
- package/esm/src/mail/errors.d.ts.map +1 -1
- package/esm/src/mail/errors.js +8 -42
- package/esm/src/mail/errors.js.map +1 -0
- package/esm/src/mail/memory.d.ts +1 -1
- package/esm/src/mail/memory.d.ts.map +1 -1
- package/esm/src/mail/memory.js +10 -14
- package/esm/src/mail/memory.js.map +1 -0
- package/esm/src/mail/mod.d.ts +0 -1
- package/esm/src/mail/mod.d.ts.map +1 -1
- package/esm/src/mail/mod.js +1 -1
- package/esm/src/mail/mod.js.map +1 -0
- package/esm/src/mail/postal.d.ts +1 -2
- package/esm/src/mail/postal.d.ts.map +1 -1
- package/esm/src/mail/postal.js +22 -18
- package/esm/src/mail/postal.js.map +1 -0
- package/esm/src/mail/retry.d.ts.map +1 -1
- package/esm/src/mail/retry.js +1 -0
- package/esm/src/mail/retry.js.map +1 -0
- package/esm/src/mail/sender.d.ts.map +1 -1
- package/esm/src/mail/sender.js +1 -0
- package/esm/src/mail/sender.js.map +1 -0
- package/esm/src/mail/service.d.ts.map +1 -1
- package/esm/src/mail/service.js +6 -7
- package/esm/src/mail/service.js.map +1 -0
- package/esm/src/mail/types.d.ts.map +1 -1
- package/esm/src/mail/types.js +1 -0
- package/esm/src/mail/types.js.map +1 -0
- package/esm/src/mui/apiKeys.d.ts +10 -11
- package/esm/src/mui/apiKeys.d.ts.map +1 -1
- package/esm/src/mui/apiKeys.js +83 -214
- package/esm/src/mui/apiKeys.js.map +1 -0
- package/esm/src/mui/apiKeysView.d.ts +1 -1
- package/esm/src/mui/apiKeysView.d.ts.map +1 -1
- package/esm/src/mui/apiKeysView.js +11 -9
- package/esm/src/mui/apiKeysView.js.map +1 -0
- package/esm/src/mui/confirm.d.ts +2 -2
- package/esm/src/mui/confirm.d.ts.map +1 -1
- package/esm/src/mui/confirm.js +3 -7
- package/esm/src/mui/confirm.js.map +1 -0
- package/esm/src/mui/mail.d.ts +4 -4
- package/esm/src/mui/mail.d.ts.map +1 -1
- package/esm/src/mui/mail.js +11 -71
- package/esm/src/mui/mail.js.map +1 -0
- package/esm/src/mui/mailView.d.ts +1 -1
- package/esm/src/mui/mailView.d.ts.map +1 -1
- package/esm/src/mui/mailView.js +1 -0
- package/esm/src/mui/mailView.js.map +1 -0
- package/esm/src/mui/mod.d.ts +0 -1
- package/esm/src/mui/mod.d.ts.map +1 -1
- package/esm/src/mui/mod.js +1 -0
- package/esm/src/mui/mod.js.map +1 -0
- package/esm/src/next/apiKeys/mod.d.ts +2 -3
- package/esm/src/next/apiKeys/mod.d.ts.map +1 -1
- package/esm/src/next/apiKeys/mod.js +6 -5
- package/esm/src/next/apiKeys/mod.js.map +1 -0
- package/esm/src/next/auth/client.d.ts +0 -1
- package/esm/src/next/auth/client.d.ts.map +1 -1
- package/esm/src/next/auth/client.js +1 -0
- package/esm/src/next/auth/client.js.map +1 -0
- package/esm/src/next/auth/config.d.ts.map +1 -1
- package/esm/src/next/auth/config.js +11 -17
- package/esm/src/next/auth/config.js.map +1 -0
- package/esm/src/next/auth/localTestLogin.d.ts.map +1 -1
- package/esm/src/next/auth/localTestLogin.js +13 -9
- package/esm/src/next/auth/localTestLogin.js.map +1 -0
- package/esm/src/next/auth/mod.d.ts.map +1 -1
- package/esm/src/next/auth/mod.js +1 -0
- package/esm/src/next/auth/mod.js.map +1 -0
- package/esm/src/next/auth/server.d.ts +2 -2
- package/esm/src/next/auth/server.d.ts.map +1 -1
- package/esm/src/next/auth/server.js +1 -0
- package/esm/src/next/auth/server.js.map +1 -0
- package/esm/src/next/files/mod.d.ts +0 -1
- package/esm/src/next/files/mod.d.ts.map +1 -1
- package/esm/src/next/files/mod.js +1 -1
- package/esm/src/next/files/mod.js.map +1 -0
- package/esm/src/next/files/route.d.ts +1 -1
- package/esm/src/next/files/route.d.ts.map +1 -1
- package/esm/src/next/files/route.js +11 -11
- package/esm/src/next/files/route.js.map +1 -0
- package/esm/src/next/jobs/list.d.ts +5 -5
- package/esm/src/next/jobs/list.d.ts.map +1 -1
- package/esm/src/next/jobs/list.js +15 -19
- package/esm/src/next/jobs/list.js.map +1 -0
- package/esm/src/next/jobs/mod.d.ts.map +1 -1
- package/esm/src/next/jobs/mod.js +1 -0
- package/esm/src/next/jobs/mod.js.map +1 -0
- package/esm/src/next/jobs/paths.d.ts +2 -2
- package/esm/src/next/jobs/paths.d.ts.map +1 -1
- package/esm/src/next/jobs/paths.js +1 -0
- package/esm/src/next/jobs/paths.js.map +1 -0
- package/esm/src/next/jobs/route.d.ts +2 -2
- package/esm/src/next/jobs/route.d.ts.map +1 -1
- package/esm/src/next/jobs/route.js +4 -4
- package/esm/src/next/jobs/route.js.map +1 -0
- package/esm/src/next/jobs/run.d.ts +2 -2
- package/esm/src/next/jobs/run.d.ts.map +1 -1
- package/esm/src/next/jobs/run.js +68 -132
- package/esm/src/next/jobs/run.js.map +1 -0
- package/esm/src/next/jobs/runRequest.d.ts +1 -1
- package/esm/src/next/jobs/runRequest.d.ts.map +1 -1
- package/esm/src/next/jobs/runRequest.js +3 -4
- package/esm/src/next/jobs/runRequest.js.map +1 -0
- package/esm/src/next/jobs/stream.d.ts.map +1 -1
- package/esm/src/next/jobs/stream.js +1 -0
- package/esm/src/next/jobs/stream.js.map +1 -0
- package/esm/src/next/mail/mod.d.ts +0 -1
- package/esm/src/next/mail/mod.d.ts.map +1 -1
- package/esm/src/next/mail/mod.js +1 -1
- package/esm/src/next/mail/mod.js.map +1 -0
- package/esm/src/next/mail/route.d.ts +2 -2
- package/esm/src/next/mail/route.d.ts.map +1 -1
- package/esm/src/next/mail/route.js +1 -0
- package/esm/src/next/mail/route.js.map +1 -0
- package/esm/src/next/pwa/mod.d.ts +0 -4
- package/esm/src/next/pwa/mod.d.ts.map +1 -1
- package/esm/src/next/pwa/mod.js +32 -16
- package/esm/src/next/pwa/mod.js.map +1 -0
- package/esm/src/next/pwa/worker.d.ts +0 -1
- package/esm/src/next/pwa/worker.d.ts.map +1 -1
- package/esm/src/next/pwa/worker.js +1 -0
- package/esm/src/next/pwa/worker.js.map +1 -0
- package/esm/src/next/secrets/constants.d.ts +3 -0
- package/esm/src/next/secrets/constants.d.ts.map +1 -0
- package/esm/src/next/secrets/constants.js +3 -0
- package/esm/src/next/secrets/constants.js.map +1 -0
- package/esm/src/next/secrets/mod.d.ts +1 -3
- package/esm/src/next/secrets/mod.d.ts.map +1 -1
- package/esm/src/next/secrets/mod.js +6 -7
- package/esm/src/next/secrets/mod.js.map +1 -0
- package/esm/src/next/sourceDev.d.ts +6 -0
- package/esm/src/next/sourceDev.d.ts.map +1 -0
- package/esm/src/next/sourceDev.js +41 -0
- package/esm/src/next/sourceDev.js.map +1 -0
- package/esm/src/secrets/encoding.d.ts.map +1 -1
- package/esm/src/secrets/encoding.js +1 -0
- package/esm/src/secrets/encoding.js.map +1 -0
- package/esm/src/secrets/errors.d.ts.map +1 -1
- package/esm/src/secrets/errors.js +3 -7
- package/esm/src/secrets/errors.js.map +1 -0
- package/esm/src/secrets/fingerprint.d.ts.map +1 -1
- package/esm/src/secrets/fingerprint.js +1 -0
- package/esm/src/secrets/fingerprint.js.map +1 -0
- package/esm/src/secrets/frame.d.ts.map +1 -1
- package/esm/src/secrets/frame.js +4 -3
- package/esm/src/secrets/frame.js.map +1 -0
- package/esm/src/secrets/keyring.d.ts.map +1 -1
- package/esm/src/secrets/keyring.js +6 -6
- package/esm/src/secrets/keyring.js.map +1 -0
- package/esm/src/secrets/legacy.d.ts +0 -1
- package/esm/src/secrets/legacy.d.ts.map +1 -1
- package/esm/src/secrets/legacy.js +13 -10
- package/esm/src/secrets/legacy.js.map +1 -0
- package/esm/src/secrets/maintenance.d.ts +0 -1
- package/esm/src/secrets/maintenance.d.ts.map +1 -1
- package/esm/src/secrets/maintenance.js +9 -24
- package/esm/src/secrets/maintenance.js.map +1 -0
- package/esm/src/secrets/mod.d.ts +0 -1
- package/esm/src/secrets/mod.d.ts.map +1 -1
- package/esm/src/secrets/mod.js +1 -1
- package/esm/src/secrets/mod.js.map +1 -0
- package/esm/src/secrets/secrets.d.ts.map +1 -1
- package/esm/src/secrets/secrets.js +38 -30
- package/esm/src/secrets/secrets.js.map +1 -0
- package/package.json +111 -135
- package/skills/loom/SKILL.md +40 -5
- package/skills/loom/references/esm-package.md +35 -0
- package/skills/loom/references/local-development.md +261 -29
- package/skills/loom-mail/SKILL.md +1 -0
- package/skills/upgrade-deps/SKILL.md +4 -2
- package/source/bin/loom.ts +50 -0
- package/source/mod.ts +10 -0
- package/source/src/apiKeys/authorize.ts +294 -0
- package/source/src/apiKeys/betterAuth.ts +253 -0
- package/source/src/apiKeys/country.ts +7 -0
- package/source/src/apiKeys/credentials.ts +171 -0
- package/source/src/apiKeys/fingerprint.ts +10 -0
- package/{script/src/apiKeys/lifecycle.d.ts → source/src/apiKeys/lifecycle.ts} +21 -23
- package/source/src/apiKeys/limits.ts +372 -0
- package/source/src/apiKeys/mod.ts +11 -0
- package/source/src/apiKeys/permissions.ts +153 -0
- package/source/src/apiKeys/policy.ts +189 -0
- package/source/src/apiKeys/retention.ts +136 -0
- package/source/src/apiKeys/types.ts +288 -0
- package/source/src/cli/atomicText.ts +38 -0
- package/source/src/cli/bunLocalDev.ts +646 -0
- package/source/src/cli/bunProject.ts +433 -0
- package/source/src/cli/cliBootstrap.ts +313 -0
- package/source/src/cli/externalSkills.ts +315 -0
- package/source/src/cli/filesR2Policy.ts +212 -0
- package/source/src/cli/generatedBuild.ts +380 -0
- package/source/src/cli/generatedCleanup.ts +87 -0
- package/source/src/cli/generatedDevLease.ts +52 -0
- package/source/src/cli/generatedInstall.ts +630 -0
- package/source/src/cli/generatedWorkflow.ts +135 -0
- package/{script/src/cli/legacyManagedOutputs.js → source/src/cli/legacyManagedOutputs.ts} +36 -30
- package/source/src/cli/localDb.ts +548 -0
- package/source/src/cli/localDevLock.ts +462 -0
- package/source/src/cli/localDevPackage.ts +754 -0
- package/source/src/cli/managedFiles.ts +688 -0
- package/source/src/cli/migrationEnv.ts +267 -0
- package/source/src/cli/mod.ts +26794 -0
- package/source/src/cli/packageTreeSignature.ts +65 -0
- package/source/src/cli/processIdentity.ts +38 -0
- package/source/src/cli/projectSkills.ts +1102 -0
- package/source/src/cli/projectTooling.ts +1140 -0
- package/source/src/cli/releaseConfig.ts +36 -0
- package/source/src/cli/releaseCredentials.ts +642 -0
- package/source/src/cli/releaseTrust.ts +194 -0
- package/source/src/cli/releaseTrustCommand.ts +210 -0
- package/source/src/cli/sourceConfig.ts +106 -0
- package/source/src/cli/sourceDev.ts +1279 -0
- package/source/src/cli/vercelBuildEnv.ts +714 -0
- package/source/src/cli/vercelEnvMask.ts +182 -0
- package/source/src/cli/vercelProjectRelease.ts +807 -0
- package/source/src/cli/vercelPulledEnv.ts +174 -0
- package/source/src/clientData/identity.ts +229 -0
- package/source/src/clientData/mod.ts +1 -0
- package/source/src/files/client.ts +75 -0
- package/source/src/files/errors.ts +69 -0
- package/source/src/files/hash.ts +109 -0
- package/source/src/files/memory.ts +158 -0
- package/source/src/files/metadata.ts +251 -0
- package/source/src/files/mod.ts +8 -0
- package/source/src/files/s3.ts +182 -0
- package/source/src/files/service.ts +210 -0
- package/source/src/files/types.ts +171 -0
- package/source/src/jobs/catalog.ts +303 -0
- package/source/src/jobs/controller.ts +156 -0
- package/source/src/jobs/direct.ts +177 -0
- package/source/src/jobs/events.ts +74 -0
- package/source/src/jobs/format.ts +233 -0
- package/source/src/jobs/http.ts +83 -0
- package/source/src/jobs/log.ts +10 -0
- package/source/src/jobs/mod.ts +10 -0
- package/source/src/jobs/run.ts +141 -0
- package/source/src/jobs/sanitize.ts +142 -0
- package/source/src/jobs/types.ts +43 -0
- package/source/src/mail/errors.ts +77 -0
- package/source/src/mail/memory.ts +451 -0
- package/source/src/mail/mod.ts +5 -0
- package/source/src/mail/postal.ts +363 -0
- package/source/src/mail/retry.ts +30 -0
- package/source/src/mail/sender.ts +57 -0
- package/source/src/mail/service.ts +252 -0
- package/source/src/mail/types.ts +229 -0
- package/source/src/mui/apiKeys.tsx +1044 -0
- package/source/src/mui/apiKeysView.ts +535 -0
- package/source/src/mui/confirm.tsx +138 -0
- package/source/src/mui/mail.tsx +279 -0
- package/source/src/mui/mailView.ts +50 -0
- package/source/src/mui/mod.ts +3 -0
- package/source/src/next/apiKeys/mod.ts +393 -0
- package/{script/src/next/auth/client.d.ts → source/src/next/auth/client.ts} +19 -5
- package/source/src/next/auth/config.ts +207 -0
- package/source/src/next/auth/localTestLogin.ts +412 -0
- package/source/src/next/auth/mod.ts +3 -0
- package/source/src/next/auth/server.ts +94 -0
- package/source/src/next/files/mod.ts +1 -0
- package/source/src/next/files/route.ts +621 -0
- package/source/src/next/jobs/list.tsx +90 -0
- package/source/src/next/jobs/mod.ts +5 -0
- package/source/src/next/jobs/paths.ts +70 -0
- package/source/src/next/jobs/route.ts +207 -0
- package/source/src/next/jobs/run.tsx +888 -0
- package/source/src/next/jobs/runRequest.ts +92 -0
- package/source/src/next/jobs/stream.ts +33 -0
- package/source/src/next/mail/mod.ts +1 -0
- package/source/src/next/mail/route.ts +75 -0
- package/source/src/next/pwa/mod.tsx +453 -0
- package/source/src/next/pwa/worker.ts +59 -0
- package/source/src/next/secrets/constants.ts +2 -0
- package/source/src/next/secrets/mod.ts +319 -0
- package/source/src/next/sourceDev.ts +50 -0
- package/source/src/secrets/encoding.ts +102 -0
- package/source/src/secrets/errors.ts +58 -0
- package/source/src/secrets/fingerprint.ts +132 -0
- package/source/src/secrets/frame.ts +119 -0
- package/source/src/secrets/keyring.ts +225 -0
- package/source/src/secrets/legacy.ts +244 -0
- package/source/src/secrets/maintenance.ts +517 -0
- package/source/src/secrets/mod.ts +38 -0
- package/source/src/secrets/secrets.ts +926 -0
- package/db/databaseTls.test.ts +0 -171
- package/db/databaseUrl.test.ts +0 -72
- package/db/neonEndpoint.test.ts +0 -51
- package/db/testing.test.ts +0 -28
- package/deno.json +0 -3
- package/esm/_dnt.polyfills.d.ts +0 -166
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -177
- package/esm/_dnt.shims.d.ts +0 -2
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/package.json +0 -3
- package/script/_dnt.polyfills.d.ts +0 -166
- package/script/_dnt.polyfills.d.ts.map +0 -1
- package/script/_dnt.polyfills.js +0 -180
- package/script/_dnt.shims.d.ts +0 -2
- package/script/_dnt.shims.d.ts.map +0 -1
- package/script/_dnt.shims.js +0 -60
- package/script/bin/loom.d.ts +0 -2
- package/script/bin/loom.d.ts.map +0 -1
- package/script/bin/loom.js +0 -17
- package/script/mod.d.ts +0 -12
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -27
- package/script/package.json +0 -3
- package/script/src/apiKeys/authorize.d.ts +0 -4
- package/script/src/apiKeys/authorize.d.ts.map +0 -1
- package/script/src/apiKeys/authorize.js +0 -258
- package/script/src/apiKeys/betterAuth.d.ts +0 -123
- package/script/src/apiKeys/betterAuth.d.ts.map +0 -1
- package/script/src/apiKeys/betterAuth.js +0 -169
- package/script/src/apiKeys/country.d.ts +0 -3
- package/script/src/apiKeys/country.d.ts.map +0 -1
- package/script/src/apiKeys/country.js +0 -10
- package/script/src/apiKeys/credentials.d.ts +0 -39
- package/script/src/apiKeys/credentials.d.ts.map +0 -1
- package/script/src/apiKeys/credentials.js +0 -121
- package/script/src/apiKeys/fingerprint.d.ts +0 -3
- package/script/src/apiKeys/fingerprint.d.ts.map +0 -1
- package/script/src/apiKeys/fingerprint.js +0 -8
- package/script/src/apiKeys/lifecycle.d.ts.map +0 -1
- package/script/src/apiKeys/lifecycle.js +0 -7
- package/script/src/apiKeys/limits.d.ts +0 -132
- package/script/src/apiKeys/limits.d.ts.map +0 -1
- package/script/src/apiKeys/limits.js +0 -254
- package/script/src/apiKeys/mod.d.ts +0 -13
- package/script/src/apiKeys/mod.d.ts.map +0 -1
- package/script/src/apiKeys/mod.js +0 -28
- package/script/src/apiKeys/permissions.d.ts +0 -56
- package/script/src/apiKeys/permissions.d.ts.map +0 -1
- package/script/src/apiKeys/permissions.js +0 -136
- package/script/src/apiKeys/policy.d.ts +0 -61
- package/script/src/apiKeys/policy.d.ts.map +0 -1
- package/script/src/apiKeys/policy.js +0 -94
- package/script/src/apiKeys/retention.d.ts +0 -55
- package/script/src/apiKeys/retention.d.ts.map +0 -1
- package/script/src/apiKeys/retention.js +0 -70
- package/script/src/apiKeys/types.d.ts +0 -242
- package/script/src/apiKeys/types.d.ts.map +0 -1
- package/script/src/apiKeys/types.js +0 -2
- package/script/src/cli/externalSkills.d.ts +0 -39
- package/script/src/cli/externalSkills.d.ts.map +0 -1
- package/script/src/cli/externalSkills.js +0 -204
- package/script/src/cli/filesR2Policy.d.ts +0 -33
- package/script/src/cli/filesR2Policy.d.ts.map +0 -1
- package/script/src/cli/filesR2Policy.js +0 -135
- package/script/src/cli/legacyManagedOutputs.d.ts +0 -33
- package/script/src/cli/legacyManagedOutputs.d.ts.map +0 -1
- package/script/src/cli/localDb.d.ts +0 -28
- package/script/src/cli/localDb.d.ts.map +0 -1
- package/script/src/cli/localDb.js +0 -370
- package/script/src/cli/localDevLock.d.ts +0 -97
- package/script/src/cli/localDevLock.d.ts.map +0 -1
- package/script/src/cli/localDevLock.js +0 -320
- package/script/src/cli/localDevPackage.d.ts +0 -172
- package/script/src/cli/localDevPackage.d.ts.map +0 -1
- package/script/src/cli/localDevPackage.js +0 -635
- package/script/src/cli/managedFiles.d.ts +0 -131
- package/script/src/cli/managedFiles.d.ts.map +0 -1
- package/script/src/cli/managedFiles.js +0 -536
- package/script/src/cli/migrationEnv.d.ts +0 -63
- package/script/src/cli/migrationEnv.d.ts.map +0 -1
- package/script/src/cli/migrationEnv.js +0 -217
- package/script/src/cli/mod.d.ts +0 -582
- package/script/src/cli/mod.d.ts.map +0 -1
- package/script/src/cli/mod.js +0 -17010
- package/script/src/cli/projectSkills.d.ts +0 -109
- package/script/src/cli/projectSkills.d.ts.map +0 -1
- package/script/src/cli/projectSkills.js +0 -749
- package/script/src/cli/projectTooling.d.ts +0 -164
- package/script/src/cli/projectTooling.d.ts.map +0 -1
- package/script/src/cli/projectTooling.js +0 -847
- package/script/src/cli/releaseConfig.d.ts +0 -10
- package/script/src/cli/releaseConfig.d.ts.map +0 -1
- package/script/src/cli/releaseConfig.js +0 -26
- package/script/src/cli/releaseCredentials.d.ts +0 -32
- package/script/src/cli/releaseCredentials.d.ts.map +0 -1
- package/script/src/cli/releaseCredentials.js +0 -392
- package/script/src/cli/releaseTrust.d.ts +0 -39
- package/script/src/cli/releaseTrust.d.ts.map +0 -1
- package/script/src/cli/releaseTrust.js +0 -130
- package/script/src/cli/releaseTrustCommand.d.ts +0 -18
- package/script/src/cli/releaseTrustCommand.d.ts.map +0 -1
- package/script/src/cli/releaseTrustCommand.js +0 -145
- package/script/src/cli/vercelBuildEnv.d.ts +0 -62
- package/script/src/cli/vercelBuildEnv.d.ts.map +0 -1
- package/script/src/cli/vercelBuildEnv.js +0 -418
- package/script/src/cli/vercelEnvMask.d.ts +0 -38
- package/script/src/cli/vercelEnvMask.d.ts.map +0 -1
- package/script/src/cli/vercelEnvMask.js +0 -142
- package/script/src/cli/vercelProjectRelease.d.ts +0 -38
- package/script/src/cli/vercelProjectRelease.d.ts.map +0 -1
- package/script/src/cli/vercelProjectRelease.js +0 -607
- package/script/src/cli/vercelPulledEnv.d.ts +0 -65
- package/script/src/cli/vercelPulledEnv.d.ts.map +0 -1
- package/script/src/cli/vercelPulledEnv.js +0 -138
- package/script/src/clientData/identity.d.ts +0 -89
- package/script/src/clientData/identity.d.ts.map +0 -1
- package/script/src/clientData/identity.js +0 -134
- package/script/src/clientData/mod.d.ts +0 -3
- package/script/src/clientData/mod.d.ts.map +0 -1
- package/script/src/clientData/mod.js +0 -18
- package/script/src/files/client.d.ts +0 -29
- package/script/src/files/client.d.ts.map +0 -1
- package/script/src/files/client.js +0 -45
- package/script/src/files/errors.d.ts +0 -37
- package/script/src/files/errors.d.ts.map +0 -1
- package/script/src/files/errors.js +0 -76
- package/script/src/files/hash.d.ts +0 -15
- package/script/src/files/hash.d.ts.map +0 -1
- package/script/src/files/hash.js +0 -89
- package/script/src/files/memory.d.ts +0 -29
- package/script/src/files/memory.d.ts.map +0 -1
- package/script/src/files/memory.js +0 -113
- package/script/src/files/metadata.d.ts +0 -10
- package/script/src/files/metadata.d.ts.map +0 -1
- package/script/src/files/metadata.js +0 -189
- package/script/src/files/mod.d.ts +0 -10
- package/script/src/files/mod.d.ts.map +0 -1
- package/script/src/files/mod.js +0 -25
- package/script/src/files/s3.d.ts +0 -29
- package/script/src/files/s3.d.ts.map +0 -1
- package/script/src/files/s3.js +0 -110
- package/script/src/files/service.d.ts +0 -27
- package/script/src/files/service.d.ts.map +0 -1
- package/script/src/files/service.js +0 -139
- package/script/src/files/types.d.ts +0 -134
- package/script/src/files/types.d.ts.map +0 -1
- package/script/src/files/types.js +0 -2
- package/script/src/jobs/catalog.d.ts +0 -32
- package/script/src/jobs/catalog.d.ts.map +0 -1
- package/script/src/jobs/catalog.js +0 -223
- package/script/src/jobs/controller.d.ts +0 -41
- package/script/src/jobs/controller.d.ts.map +0 -1
- package/script/src/jobs/controller.js +0 -151
- package/script/src/jobs/direct.d.ts +0 -36
- package/script/src/jobs/direct.d.ts.map +0 -1
- package/script/src/jobs/direct.js +0 -128
- package/script/src/jobs/events.d.ts +0 -23
- package/script/src/jobs/events.d.ts.map +0 -1
- package/script/src/jobs/events.js +0 -50
- package/script/src/jobs/format.d.ts +0 -16
- package/script/src/jobs/format.d.ts.map +0 -1
- package/script/src/jobs/format.js +0 -193
- package/script/src/jobs/http.d.ts +0 -22
- package/script/src/jobs/http.d.ts.map +0 -1
- package/script/src/jobs/http.js +0 -50
- package/script/src/jobs/log.d.ts +0 -2
- package/script/src/jobs/log.d.ts.map +0 -1
- package/script/src/jobs/log.js +0 -13
- package/script/src/jobs/mod.d.ts +0 -11
- package/script/src/jobs/mod.d.ts.map +0 -1
- package/script/src/jobs/mod.js +0 -26
- package/script/src/jobs/run.d.ts +0 -39
- package/script/src/jobs/run.d.ts.map +0 -1
- package/script/src/jobs/run.js +0 -86
- package/script/src/jobs/sanitize.d.ts +0 -30
- package/script/src/jobs/sanitize.d.ts.map +0 -1
- package/script/src/jobs/sanitize.js +0 -97
- package/script/src/jobs/types.d.ts +0 -31
- package/script/src/jobs/types.d.ts.map +0 -1
- package/script/src/jobs/types.js +0 -2
- package/script/src/mail/errors.d.ts +0 -33
- package/script/src/mail/errors.d.ts.map +0 -1
- package/script/src/mail/errors.js +0 -97
- package/script/src/mail/memory.d.ts +0 -30
- package/script/src/mail/memory.d.ts.map +0 -1
- package/script/src/mail/memory.js +0 -345
- package/script/src/mail/mod.d.ts +0 -7
- package/script/src/mail/mod.d.ts.map +0 -1
- package/script/src/mail/mod.js +0 -22
- package/script/src/mail/postal.d.ts +0 -57
- package/script/src/mail/postal.d.ts.map +0 -1
- package/script/src/mail/postal.js +0 -251
- package/script/src/mail/retry.d.ts +0 -9
- package/script/src/mail/retry.d.ts.map +0 -1
- package/script/src/mail/retry.js +0 -22
- package/script/src/mail/sender.d.ts +0 -5
- package/script/src/mail/sender.d.ts.map +0 -1
- package/script/src/mail/sender.js +0 -52
- package/script/src/mail/service.d.ts +0 -23
- package/script/src/mail/service.d.ts.map +0 -1
- package/script/src/mail/service.js +0 -191
- package/script/src/mail/types.d.ts +0 -176
- package/script/src/mail/types.d.ts.map +0 -1
- package/script/src/mail/types.js +0 -2
- package/script/src/mui/apiKeys.d.ts +0 -171
- package/script/src/mui/apiKeys.d.ts.map +0 -1
- package/script/src/mui/apiKeys.js +0 -470
- package/script/src/mui/apiKeysView.d.ts +0 -193
- package/script/src/mui/apiKeysView.d.ts.map +0 -1
- package/script/src/mui/apiKeysView.js +0 -331
- package/script/src/mui/confirm.d.ts +0 -12
- package/script/src/mui/confirm.d.ts.map +0 -1
- package/script/src/mui/confirm.js +0 -85
- package/script/src/mui/mail.d.ts +0 -29
- package/script/src/mui/mail.d.ts.map +0 -1
- package/script/src/mui/mail.js +0 -159
- package/script/src/mui/mailView.d.ts +0 -20
- package/script/src/mui/mailView.d.ts.map +0 -1
- package/script/src/mui/mailView.js +0 -32
- package/script/src/mui/mod.d.ts +0 -5
- package/script/src/mui/mod.d.ts.map +0 -1
- package/script/src/mui/mod.js +0 -20
- package/script/src/next/apiKeys/mod.d.ts +0 -71
- package/script/src/next/apiKeys/mod.d.ts.map +0 -1
- package/script/src/next/apiKeys/mod.js +0 -227
- package/script/src/next/auth/client.d.ts.map +0 -1
- package/script/src/next/auth/client.js +0 -39
- package/script/src/next/auth/config.d.ts +0 -62
- package/script/src/next/auth/config.d.ts.map +0 -1
- package/script/src/next/auth/config.js +0 -178
- package/script/src/next/auth/localTestLogin.d.ts +0 -75
- package/script/src/next/auth/localTestLogin.d.ts.map +0 -1
- package/script/src/next/auth/localTestLogin.js +0 -291
- package/script/src/next/auth/mod.d.ts +0 -4
- package/script/src/next/auth/mod.d.ts.map +0 -1
- package/script/src/next/auth/mod.js +0 -19
- package/script/src/next/auth/server.d.ts +0 -44
- package/script/src/next/auth/server.d.ts.map +0 -1
- package/script/src/next/auth/server.js +0 -39
- package/script/src/next/files/mod.d.ts +0 -3
- package/script/src/next/files/mod.d.ts.map +0 -1
- package/script/src/next/files/mod.js +0 -18
- package/script/src/next/files/route.d.ts +0 -99
- package/script/src/next/files/route.d.ts.map +0 -1
- package/script/src/next/files/route.js +0 -353
- package/script/src/next/jobs/list.d.ts +0 -25
- package/script/src/next/jobs/list.d.ts.map +0 -1
- package/script/src/next/jobs/list.js +0 -48
- package/script/src/next/jobs/mod.d.ts +0 -6
- package/script/src/next/jobs/mod.d.ts.map +0 -1
- package/script/src/next/jobs/mod.js +0 -21
- package/script/src/next/jobs/paths.d.ts +0 -14
- package/script/src/next/jobs/paths.d.ts.map +0 -1
- package/script/src/next/jobs/paths.js +0 -47
- package/script/src/next/jobs/route.d.ts +0 -48
- package/script/src/next/jobs/route.d.ts.map +0 -1
- package/script/src/next/jobs/route.js +0 -105
- package/script/src/next/jobs/run.d.ts +0 -58
- package/script/src/next/jobs/run.d.ts.map +0 -1
- package/script/src/next/jobs/run.js +0 -592
- package/script/src/next/jobs/runRequest.d.ts +0 -19
- package/script/src/next/jobs/runRequest.d.ts.map +0 -1
- package/script/src/next/jobs/runRequest.js +0 -81
- package/script/src/next/jobs/stream.d.ts +0 -3
- package/script/src/next/jobs/stream.d.ts.map +0 -1
- package/script/src/next/jobs/stream.js +0 -28
- package/script/src/next/mail/mod.d.ts +0 -3
- package/script/src/next/mail/mod.d.ts.map +0 -1
- package/script/src/next/mail/mod.js +0 -18
- package/script/src/next/mail/route.d.ts +0 -12
- package/script/src/next/mail/route.d.ts.map +0 -1
- package/script/src/next/mail/route.js +0 -46
- package/script/src/next/pwa/mod.d.ts +0 -112
- package/script/src/next/pwa/mod.d.ts.map +0 -1
- package/script/src/next/pwa/mod.js +0 -303
- package/script/src/next/pwa/worker.d.ts +0 -27
- package/script/src/next/pwa/worker.d.ts.map +0 -1
- package/script/src/next/pwa/worker.js +0 -33
- package/script/src/next/secrets/mod.d.ts +0 -108
- package/script/src/next/secrets/mod.d.ts.map +0 -1
- package/script/src/next/secrets/mod.js +0 -218
- package/script/src/secrets/encoding.d.ts +0 -32
- package/script/src/secrets/encoding.d.ts.map +0 -1
- package/script/src/secrets/encoding.js +0 -95
- package/script/src/secrets/errors.d.ts +0 -45
- package/script/src/secrets/errors.d.ts.map +0 -1
- package/script/src/secrets/errors.js +0 -45
- package/script/src/secrets/fingerprint.d.ts +0 -43
- package/script/src/secrets/fingerprint.d.ts.map +0 -1
- package/script/src/secrets/fingerprint.js +0 -92
- package/script/src/secrets/frame.d.ts +0 -34
- package/script/src/secrets/frame.d.ts.map +0 -1
- package/script/src/secrets/frame.js +0 -91
- package/script/src/secrets/keyring.d.ts +0 -62
- package/script/src/secrets/keyring.d.ts.map +0 -1
- package/script/src/secrets/keyring.js +0 -202
- package/script/src/secrets/legacy.d.ts +0 -60
- package/script/src/secrets/legacy.d.ts.map +0 -1
- package/script/src/secrets/legacy.js +0 -186
- package/script/src/secrets/maintenance.d.ts +0 -173
- package/script/src/secrets/maintenance.d.ts.map +0 -1
- package/script/src/secrets/maintenance.js +0 -323
- package/script/src/secrets/mod.d.ts +0 -6
- package/script/src/secrets/mod.d.ts.map +0 -1
- package/script/src/secrets/mod.js +0 -24
- package/script/src/secrets/secrets.d.ts +0 -192
- package/script/src/secrets/secrets.d.ts.map +0 -1
- package/script/src/secrets/secrets.js +0 -532
|
@@ -0,0 +1,688 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ownership proof for files Loom writes into consumer projects.
|
|
3
|
+
*
|
|
4
|
+
* Loom may create a missing file, or replace one it can prove is unmodified
|
|
5
|
+
* Loom output. Anything else belongs to the app: Loom leaves it in place and
|
|
6
|
+
* reports how it differs, so a scaffold or wrapper sync can never discard
|
|
7
|
+
* consumer code.
|
|
8
|
+
*/
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
11
|
+
import { dirname } from "node:path";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Evidence that the file currently on disk is something Loom wrote.
|
|
15
|
+
*/
|
|
16
|
+
export type ManagedFileProof = {
|
|
17
|
+
/**
|
|
18
|
+
* Hash (see {@link hashManagedFileText}) that the manifest recorded when
|
|
19
|
+
* Loom last wrote or verified this file. When present with the current
|
|
20
|
+
* {@link MANAGED_HASH_VERSION} it is the only proof: `knownOutputs` and
|
|
21
|
+
* `isLoomOutput` only cover files without such a record.
|
|
22
|
+
*/
|
|
23
|
+
recordedHash?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Complete texts that earlier Loom releases, or earlier recorded
|
|
26
|
+
* configurations, wrote to this path.
|
|
27
|
+
*/
|
|
28
|
+
knownOutputs?: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* Structural proof for generated files whose earlier text depends on
|
|
31
|
+
* project state Loom no longer knows, such as a generated barrel.
|
|
32
|
+
*/
|
|
33
|
+
isLoomOutput?: (text: string) => boolean | Promise<boolean>;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Where a managed file stands relative to Loom's current output:
|
|
38
|
+
* - `missing`: the file does not exist;
|
|
39
|
+
* - `current`: it matches Loom's output, ignoring formatting;
|
|
40
|
+
* - `loom-output`: it is provably earlier Loom output that Loom may replace;
|
|
41
|
+
* - `customized`: it has local edits, or Loom cannot prove that it wrote it.
|
|
42
|
+
*/
|
|
43
|
+
export type ManagedFileState =
|
|
44
|
+
| "missing"
|
|
45
|
+
| "current"
|
|
46
|
+
| "loom-output"
|
|
47
|
+
| "customized";
|
|
48
|
+
|
|
49
|
+
/** Result of comparing a managed file with Loom's output. */
|
|
50
|
+
export type ManagedFileClassification = {
|
|
51
|
+
/** Hash of Loom's current output for the file. */
|
|
52
|
+
expectedHash: string;
|
|
53
|
+
state: ManagedFileState;
|
|
54
|
+
/** One-line summary of the local edits, for `customized` files. */
|
|
55
|
+
difference?: string;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Result of {@link syncManagedFile}. */
|
|
59
|
+
export type ManagedFileSyncResult = {
|
|
60
|
+
state: "created" | "updated" | "unchanged" | "customized";
|
|
61
|
+
/**
|
|
62
|
+
* Hash to record for the file, or `undefined` when Loom left local edits in
|
|
63
|
+
* place and the previous record should be kept.
|
|
64
|
+
*/
|
|
65
|
+
hash?: string;
|
|
66
|
+
/** One-line summary of the local edits, for `customized` files. */
|
|
67
|
+
difference?: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const COMMENT_MARK = "\u0001";
|
|
71
|
+
/** A line break where automatic semicolon insertion changes the meaning. */
|
|
72
|
+
const LINE_BREAK_MARK = "\u0002";
|
|
73
|
+
const OPERATOR_CHARS = new Set("+-*/%&|^!~<>=?:.");
|
|
74
|
+
/** Characters after which `/` starts a regular expression, not a division. */
|
|
75
|
+
const REGEX_PREFIX_CHARS = new Set("(,=:[!&|?{};+-*%<>~^");
|
|
76
|
+
const REGEX_PREFIX_WORDS = new Set([
|
|
77
|
+
"await",
|
|
78
|
+
"case",
|
|
79
|
+
"delete",
|
|
80
|
+
"do",
|
|
81
|
+
"else",
|
|
82
|
+
"in",
|
|
83
|
+
"instanceof",
|
|
84
|
+
"new",
|
|
85
|
+
"of",
|
|
86
|
+
"return",
|
|
87
|
+
"throw",
|
|
88
|
+
"typeof",
|
|
89
|
+
"void",
|
|
90
|
+
"yield",
|
|
91
|
+
]);
|
|
92
|
+
/** Keywords a line break ends a statement after (restricted productions). */
|
|
93
|
+
const RESTRICTED_WORDS = new Set([
|
|
94
|
+
"async",
|
|
95
|
+
"break",
|
|
96
|
+
"continue",
|
|
97
|
+
"return",
|
|
98
|
+
"throw",
|
|
99
|
+
"yield",
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
function isIdentifierChar(char: string | undefined) {
|
|
103
|
+
return !!char && /[0-9A-Za-z_$]/.test(char);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function trailingWord(text: string) {
|
|
107
|
+
return text.match(/[0-9A-Za-z_$]+$/)?.[0];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function collapseWhitespace(text: string) {
|
|
111
|
+
return text.split(/\s+/).filter(Boolean).join(" ");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function skipTrivia(source: string, start: number) {
|
|
115
|
+
let index = start;
|
|
116
|
+
while (index < source.length) {
|
|
117
|
+
const char = source[index];
|
|
118
|
+
const next = source[index + 1];
|
|
119
|
+
if (/\s/.test(char)) {
|
|
120
|
+
index++;
|
|
121
|
+
} else if (char === "/" && next === "/") {
|
|
122
|
+
const end = source.indexOf("\n", index);
|
|
123
|
+
index = end < 0 ? source.length : end;
|
|
124
|
+
} else if (char === "/" && next === "*") {
|
|
125
|
+
const end = source.indexOf("*/", index + 2);
|
|
126
|
+
index = end < 0 ? source.length : end + 2;
|
|
127
|
+
} else {
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return index;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Index just past a `'` or `"` string; an unterminated one ends at the line. */
|
|
135
|
+
function scanQuoted(source: string, start: number) {
|
|
136
|
+
const quote = source[start];
|
|
137
|
+
let index = start + 1;
|
|
138
|
+
while (
|
|
139
|
+
index < source.length &&
|
|
140
|
+
source[index] !== quote &&
|
|
141
|
+
source[index] !== "\n"
|
|
142
|
+
) {
|
|
143
|
+
index += source[index] === "\\" ? 2 : 1;
|
|
144
|
+
}
|
|
145
|
+
return Math.min(index + 1, source.length);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Index just past a template literal, including nested `${}` expressions. */
|
|
149
|
+
function scanTemplate(source: string, start: number): number {
|
|
150
|
+
let index = start + 1;
|
|
151
|
+
while (index < source.length) {
|
|
152
|
+
const char = source[index];
|
|
153
|
+
if (char === "\\") {
|
|
154
|
+
index += 2;
|
|
155
|
+
} else if (char === "`") {
|
|
156
|
+
return index + 1;
|
|
157
|
+
} else if (char === "$" && source[index + 1] === "{") {
|
|
158
|
+
index = scanTemplateExpression(source, index + 2);
|
|
159
|
+
} else {
|
|
160
|
+
index++;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return source.length;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Index just past the `}` that closes a template literal's `${` expression. */
|
|
167
|
+
function scanTemplateExpression(source: string, start: number) {
|
|
168
|
+
let depth = 0;
|
|
169
|
+
let index = start;
|
|
170
|
+
while (index < source.length) {
|
|
171
|
+
const char = source[index];
|
|
172
|
+
if (char === '"' || char === "'") {
|
|
173
|
+
index = scanQuoted(source, index);
|
|
174
|
+
} else if (char === "`") {
|
|
175
|
+
index = scanTemplate(source, index);
|
|
176
|
+
} else if (char === "{") {
|
|
177
|
+
depth++;
|
|
178
|
+
index++;
|
|
179
|
+
} else if (char === "}") {
|
|
180
|
+
if (depth === 0) return index + 1;
|
|
181
|
+
depth--;
|
|
182
|
+
index++;
|
|
183
|
+
} else {
|
|
184
|
+
index++;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return source.length;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Index just past a regular expression literal, or -1 if `/` starts none. */
|
|
191
|
+
function scanRegex(source: string, start: number) {
|
|
192
|
+
let index = start + 1;
|
|
193
|
+
let inClass = false;
|
|
194
|
+
while (index < source.length) {
|
|
195
|
+
const char = source[index];
|
|
196
|
+
if (char === "\n") return -1;
|
|
197
|
+
if (char === "\\") {
|
|
198
|
+
index += 2;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (inClass) {
|
|
202
|
+
if (char === "]") inClass = false;
|
|
203
|
+
} else if (char === "[") {
|
|
204
|
+
inClass = true;
|
|
205
|
+
} else if (char === "/") {
|
|
206
|
+
index++;
|
|
207
|
+
while (index < source.length && /[A-Za-z]/.test(source[index])) index++;
|
|
208
|
+
return index;
|
|
209
|
+
}
|
|
210
|
+
index++;
|
|
211
|
+
}
|
|
212
|
+
return -1;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Whether a `/` after `previous` canonical text starts a regex literal. */
|
|
216
|
+
function startsRegex(previous: string) {
|
|
217
|
+
const last = previous.at(-1);
|
|
218
|
+
if (last === undefined || last === COMMENT_MARK || last === LINE_BREAK_MARK) {
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
if (REGEX_PREFIX_CHARS.has(last)) return true;
|
|
222
|
+
const word = trailingWord(previous);
|
|
223
|
+
return word !== undefined && REGEX_PREFIX_WORDS.has(word);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Reduces source text to a formatting-insensitive form, so a consumer
|
|
228
|
+
* formatter's output still counts as Loom's own. Indentation, line wrapping,
|
|
229
|
+
* line endings, trailing commas and the quote style of plain string literals
|
|
230
|
+
* are ignored. Everything that can change meaning is kept: comment text
|
|
231
|
+
* (a comment-only edit is still a local edit), semicolons, string, template
|
|
232
|
+
* and regular expression contents, whitespace between operator characters
|
|
233
|
+
* (`a - -b` is not `a--b`), and line breaks where automatic semicolon
|
|
234
|
+
* insertion applies (before `++`/`--`, and after `return` and the other
|
|
235
|
+
* restricted keywords).
|
|
236
|
+
*/
|
|
237
|
+
export function canonicalizeManagedFileText(text: string) {
|
|
238
|
+
const source = text.replace(/^\uFEFF/, "").replace(/\r\n?/g, "\n");
|
|
239
|
+
let result = "";
|
|
240
|
+
// Whether trivia separated the previous token from the next one.
|
|
241
|
+
let separated = false;
|
|
242
|
+
const append = (token: string) => {
|
|
243
|
+
const previous = result.at(-1);
|
|
244
|
+
if (
|
|
245
|
+
separated &&
|
|
246
|
+
((isIdentifierChar(previous) && isIdentifierChar(token[0])) ||
|
|
247
|
+
(OPERATOR_CHARS.has(previous ?? "") && OPERATOR_CHARS.has(token[0])))
|
|
248
|
+
) {
|
|
249
|
+
result += " ";
|
|
250
|
+
}
|
|
251
|
+
separated = false;
|
|
252
|
+
result += token;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
let index = 0;
|
|
256
|
+
while (index < source.length) {
|
|
257
|
+
const char = source[index];
|
|
258
|
+
const next = source[index + 1];
|
|
259
|
+
|
|
260
|
+
if (/\s/.test(char)) {
|
|
261
|
+
let end = index;
|
|
262
|
+
let lineBreak = false;
|
|
263
|
+
while (end < source.length && /\s/.test(source[end])) {
|
|
264
|
+
if (source[end] === "\n") lineBreak = true;
|
|
265
|
+
end++;
|
|
266
|
+
}
|
|
267
|
+
const following = source.slice(end, end + 2);
|
|
268
|
+
const word = trailingWord(result);
|
|
269
|
+
if (
|
|
270
|
+
lineBreak &&
|
|
271
|
+
(following === "++" ||
|
|
272
|
+
following === "--" ||
|
|
273
|
+
(word !== undefined &&
|
|
274
|
+
RESTRICTED_WORDS.has(word) &&
|
|
275
|
+
!isIdentifierChar(result.at(-word.length - 1))))
|
|
276
|
+
) {
|
|
277
|
+
result += LINE_BREAK_MARK;
|
|
278
|
+
separated = false;
|
|
279
|
+
} else {
|
|
280
|
+
separated = true;
|
|
281
|
+
}
|
|
282
|
+
index = end;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (char === "/" && (next === "/" || next === "*")) {
|
|
287
|
+
const blockEnd = next === "*" ? source.indexOf("*/", index + 2) : -1;
|
|
288
|
+
const lineEnd = next === "/" ? source.indexOf("\n", index) : -1;
|
|
289
|
+
const bodyEnd =
|
|
290
|
+
next === "*"
|
|
291
|
+
? blockEnd < 0
|
|
292
|
+
? source.length
|
|
293
|
+
: blockEnd
|
|
294
|
+
: lineEnd < 0
|
|
295
|
+
? source.length
|
|
296
|
+
: lineEnd;
|
|
297
|
+
append(
|
|
298
|
+
`${COMMENT_MARK}${collapseWhitespace(
|
|
299
|
+
source.slice(index + 2, bodyEnd),
|
|
300
|
+
)}${COMMENT_MARK}`,
|
|
301
|
+
);
|
|
302
|
+
separated = true;
|
|
303
|
+
index = next === "*" && blockEnd >= 0 ? blockEnd + 2 : bodyEnd;
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (char === "/" && startsRegex(result)) {
|
|
308
|
+
const end = scanRegex(source, index);
|
|
309
|
+
if (end > 0) {
|
|
310
|
+
append(source.slice(index, end));
|
|
311
|
+
index = end;
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (char === ",") {
|
|
317
|
+
const following = source[skipTrivia(source, index + 1)];
|
|
318
|
+
if (following === ")" || following === "]" || following === "}") {
|
|
319
|
+
index++;
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (char === '"' || char === "'") {
|
|
325
|
+
const end = scanQuoted(source, index);
|
|
326
|
+
const content = source.slice(index + 1, end - 1);
|
|
327
|
+
append(
|
|
328
|
+
char === "'" && !content.includes('"') && !content.includes("\\")
|
|
329
|
+
? `"${content}"`
|
|
330
|
+
: source.slice(index, end),
|
|
331
|
+
);
|
|
332
|
+
index = end;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (char === "`") {
|
|
337
|
+
const end = scanTemplate(source, index);
|
|
338
|
+
append(source.slice(index, end));
|
|
339
|
+
index = end;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
append(char);
|
|
344
|
+
index++;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return result;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Version of the canonical forms that recorded hashes are prefixed with, as
|
|
352
|
+
* in `c1:<sha256>`. A future change to either canonicaliser bumps it, so
|
|
353
|
+
* older records are treated as absent instead of permanently disowning
|
|
354
|
+
* unmodified files whose canonical form changed.
|
|
355
|
+
*/
|
|
356
|
+
export const MANAGED_HASH_VERSION = "c1";
|
|
357
|
+
|
|
358
|
+
function versionedHash(canonical: string) {
|
|
359
|
+
return `${MANAGED_HASH_VERSION}:${createHash("sha256")
|
|
360
|
+
.update(canonical)
|
|
361
|
+
.digest("hex")}`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* The recorded hash when it was made with the current canonicaliser
|
|
366
|
+
* version; any other or missing version, or a value that is not a string
|
|
367
|
+
* (a hand-edited `loom.json`), counts as no record.
|
|
368
|
+
*/
|
|
369
|
+
function currentRecordedHash(recordedHash: unknown) {
|
|
370
|
+
return typeof recordedHash === "string" &&
|
|
371
|
+
recordedHash.startsWith(`${MANAGED_HASH_VERSION}:`)
|
|
372
|
+
? recordedHash
|
|
373
|
+
: undefined;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Versioned hash of {@link canonicalizeManagedFileText}, as recorded in
|
|
378
|
+
* `loom.json`.
|
|
379
|
+
*/
|
|
380
|
+
export function hashManagedFileText(text: string) {
|
|
381
|
+
return versionedHash(canonicalizeManagedFileText(text));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
type SignificantLine = { number: number; text: string };
|
|
385
|
+
|
|
386
|
+
function significantLines(text: string): SignificantLine[] {
|
|
387
|
+
return text
|
|
388
|
+
.replace(/\r\n?/g, "\n")
|
|
389
|
+
.split("\n")
|
|
390
|
+
.flatMap((line, index) => {
|
|
391
|
+
const trimmed = line.trim();
|
|
392
|
+
return trimmed ? [{ number: index + 1, text: trimmed }] : [];
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function quoteLine(text: string) {
|
|
397
|
+
const short = text.length > 72 ? `${text.slice(0, 69)}...` : text;
|
|
398
|
+
return `\`${short}\``;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function plural(count: number, word: string) {
|
|
402
|
+
return `${count} ${word}${count === 1 ? "" : "s"}`;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function diffSignificantLines(currentText: string, expectedText: string) {
|
|
406
|
+
const local = significantLines(currentText);
|
|
407
|
+
const loom = significantLines(expectedText);
|
|
408
|
+
const localOnly: SignificantLine[] = [];
|
|
409
|
+
const loomOnly: SignificantLine[] = [];
|
|
410
|
+
|
|
411
|
+
if (local.length * loom.length <= 4_000_000) {
|
|
412
|
+
// Longest common subsequence over trimmed lines; the managed files are
|
|
413
|
+
// small, so the quadratic table is cheap.
|
|
414
|
+
const width = loom.length + 1;
|
|
415
|
+
const table = new Uint32Array((local.length + 1) * width);
|
|
416
|
+
for (let i = local.length - 1; i >= 0; i--) {
|
|
417
|
+
for (let j = loom.length - 1; j >= 0; j--) {
|
|
418
|
+
table[i * width + j] =
|
|
419
|
+
local[i].text === loom[j].text
|
|
420
|
+
? table[(i + 1) * width + j + 1] + 1
|
|
421
|
+
: Math.max(table[(i + 1) * width + j], table[i * width + j + 1]);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
let i = 0;
|
|
425
|
+
let j = 0;
|
|
426
|
+
while (i < local.length && j < loom.length) {
|
|
427
|
+
if (local[i].text === loom[j].text) {
|
|
428
|
+
i++;
|
|
429
|
+
j++;
|
|
430
|
+
} else if (table[(i + 1) * width + j] >= table[i * width + j + 1]) {
|
|
431
|
+
localOnly.push(local[i++]);
|
|
432
|
+
} else {
|
|
433
|
+
loomOnly.push(loom[j++]);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
localOnly.push(...local.slice(i));
|
|
437
|
+
loomOnly.push(...loom.slice(j));
|
|
438
|
+
} else {
|
|
439
|
+
let index = 0;
|
|
440
|
+
while (
|
|
441
|
+
index < local.length &&
|
|
442
|
+
index < loom.length &&
|
|
443
|
+
local[index].text === loom[index].text
|
|
444
|
+
) {
|
|
445
|
+
index++;
|
|
446
|
+
}
|
|
447
|
+
localOnly.push(...local.slice(index));
|
|
448
|
+
loomOnly.push(...loom.slice(index));
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return { localOnly, loomOnly };
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Summarizes how a local file differs from Loom's output in one line: how
|
|
456
|
+
* many lines exist only on each side, and the first line of each. Indentation
|
|
457
|
+
* and blank lines are ignored. Given several Loom versions, it describes the
|
|
458
|
+
* difference from the closest one.
|
|
459
|
+
*/
|
|
460
|
+
export function describeManagedFileDifference(
|
|
461
|
+
currentText: string,
|
|
462
|
+
expected: string | readonly string[],
|
|
463
|
+
) {
|
|
464
|
+
const candidates = typeof expected === "string" ? [expected] : expected;
|
|
465
|
+
let closest: ReturnType<typeof diffSignificantLines> | undefined;
|
|
466
|
+
for (const candidate of candidates) {
|
|
467
|
+
const diff = diffSignificantLines(currentText, candidate);
|
|
468
|
+
if (
|
|
469
|
+
!closest ||
|
|
470
|
+
diff.localOnly.length + diff.loomOnly.length <
|
|
471
|
+
closest.localOnly.length + closest.loomOnly.length
|
|
472
|
+
) {
|
|
473
|
+
closest = diff;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const { localOnly, loomOnly } =
|
|
477
|
+
closest ?? diffSignificantLines(currentText, "");
|
|
478
|
+
|
|
479
|
+
if (!localOnly.length && !loomOnly.length) {
|
|
480
|
+
return "differs from Loom's version only in layout";
|
|
481
|
+
}
|
|
482
|
+
const parts = [
|
|
483
|
+
`${plural(localOnly.length, "line")} only in the local file, ${plural(
|
|
484
|
+
loomOnly.length,
|
|
485
|
+
"line",
|
|
486
|
+
)} only in Loom's version`,
|
|
487
|
+
];
|
|
488
|
+
if (localOnly[0]) {
|
|
489
|
+
parts.push(
|
|
490
|
+
`first local line ${localOnly[0].number}: ${quoteLine(
|
|
491
|
+
localOnly[0].text,
|
|
492
|
+
)}`,
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
if (loomOnly[0]) {
|
|
496
|
+
parts.push(`first Loom line: ${quoteLine(loomOnly[0].text)}`);
|
|
497
|
+
}
|
|
498
|
+
return parts.join("; ");
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
async function isProvenLoomOutput(
|
|
502
|
+
text: string,
|
|
503
|
+
hash: string,
|
|
504
|
+
proof: ManagedFileProof,
|
|
505
|
+
) {
|
|
506
|
+
// Once Loom has recorded what it wrote, the record alone proves ownership;
|
|
507
|
+
// known outputs and structural checks only cover files from before it.
|
|
508
|
+
const recordedHash = currentRecordedHash(proof.recordedHash);
|
|
509
|
+
if (recordedHash !== undefined) return recordedHash === hash;
|
|
510
|
+
if (
|
|
511
|
+
proof.knownOutputs?.some((output) => hashManagedFileText(output) === hash)
|
|
512
|
+
) {
|
|
513
|
+
return true;
|
|
514
|
+
}
|
|
515
|
+
return (await proof.isLoomOutput?.(text)) ?? false;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Classifies existing file content against Loom's current output without
|
|
520
|
+
* writing anything. `loom check` and the sync helpers share this rule.
|
|
521
|
+
*/
|
|
522
|
+
export async function classifyManagedFile(
|
|
523
|
+
currentText: string | null,
|
|
524
|
+
expectedText: string,
|
|
525
|
+
proof: ManagedFileProof = {},
|
|
526
|
+
): Promise<ManagedFileClassification> {
|
|
527
|
+
const expectedHash = hashManagedFileText(expectedText);
|
|
528
|
+
if (currentText === null) return { expectedHash, state: "missing" };
|
|
529
|
+
const currentHash = hashManagedFileText(currentText);
|
|
530
|
+
if (currentHash === expectedHash) return { expectedHash, state: "current" };
|
|
531
|
+
if (await isProvenLoomOutput(currentText, currentHash, proof)) {
|
|
532
|
+
return { expectedHash, state: "loom-output" };
|
|
533
|
+
}
|
|
534
|
+
return {
|
|
535
|
+
difference: describeManagedFileDifference(currentText, expectedText),
|
|
536
|
+
expectedHash,
|
|
537
|
+
state: "customized",
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
async function readTextIfExists(path: string) {
|
|
542
|
+
try {
|
|
543
|
+
return await readFile(path, "utf8");
|
|
544
|
+
} catch (error) {
|
|
545
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return null;
|
|
546
|
+
throw error;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Writes Loom's output for a managed file when the file is missing or is
|
|
552
|
+
* provably unmodified Loom output. A file that already matches, ignoring
|
|
553
|
+
* formatting, is left untouched so consumer formatting survives. A file with
|
|
554
|
+
* local edits is never written; the result describes the difference.
|
|
555
|
+
*/
|
|
556
|
+
export async function syncManagedFile(
|
|
557
|
+
path: string,
|
|
558
|
+
text: string,
|
|
559
|
+
proof: ManagedFileProof = {},
|
|
560
|
+
): Promise<ManagedFileSyncResult> {
|
|
561
|
+
const currentText = await readTextIfExists(path);
|
|
562
|
+
const classification = await classifyManagedFile(currentText, text, proof);
|
|
563
|
+
switch (classification.state) {
|
|
564
|
+
case "current":
|
|
565
|
+
return { hash: classification.expectedHash, state: "unchanged" };
|
|
566
|
+
case "customized":
|
|
567
|
+
return {
|
|
568
|
+
difference: classification.difference,
|
|
569
|
+
state: "customized",
|
|
570
|
+
};
|
|
571
|
+
case "missing":
|
|
572
|
+
case "loom-output":
|
|
573
|
+
await mkdir(dirname(path), { recursive: true });
|
|
574
|
+
await writeFile(path, text, "utf8");
|
|
575
|
+
return {
|
|
576
|
+
hash: classification.expectedHash,
|
|
577
|
+
state: classification.state === "missing" ? "created" : "updated",
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Deletes a file Loom generated and no longer needs, but only when it is
|
|
584
|
+
* provably unmodified Loom output.
|
|
585
|
+
*/
|
|
586
|
+
export async function removeManagedFile(
|
|
587
|
+
path: string,
|
|
588
|
+
proof: ManagedFileProof,
|
|
589
|
+
): Promise<"missing" | "removed" | "customized"> {
|
|
590
|
+
const currentText = await readTextIfExists(path);
|
|
591
|
+
if (currentText === null) return "missing";
|
|
592
|
+
if (
|
|
593
|
+
!(await isProvenLoomOutput(
|
|
594
|
+
currentText,
|
|
595
|
+
hashManagedFileText(currentText),
|
|
596
|
+
proof,
|
|
597
|
+
))
|
|
598
|
+
) {
|
|
599
|
+
return "customized";
|
|
600
|
+
}
|
|
601
|
+
await rm(path);
|
|
602
|
+
return "removed";
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Evidence that a task definition is a value Loom wrote.
|
|
607
|
+
*/
|
|
608
|
+
export type ManagedTaskProof = {
|
|
609
|
+
/**
|
|
610
|
+
* Hash (see {@link hashManagedTaskDefinition}) recorded in `loom.json`.
|
|
611
|
+
* When present with the current {@link MANAGED_HASH_VERSION} it is the only
|
|
612
|
+
* proof.
|
|
613
|
+
*/
|
|
614
|
+
recordedHash?: string;
|
|
615
|
+
/**
|
|
616
|
+
* Values earlier Loom releases, or Loom under other recorded tooling,
|
|
617
|
+
* wrote for the task.
|
|
618
|
+
*/
|
|
619
|
+
knownValues?: readonly unknown[];
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
function normalizeTaskCommand(command: string) {
|
|
623
|
+
return command.trim().replace(/\s+/g, " ");
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Reduces a package script or Deno task definition to a comparable form.
|
|
628
|
+
* Surrounding and repeated whitespace is ignored, and a Deno object holding
|
|
629
|
+
* only `command` equals the same plain string. Any other key, such as a
|
|
630
|
+
* description or dependencies, is part of the value.
|
|
631
|
+
*/
|
|
632
|
+
export function canonicalizeManagedTaskDefinition(definition: unknown) {
|
|
633
|
+
if (typeof definition === "string") {
|
|
634
|
+
return JSON.stringify(normalizeTaskCommand(definition));
|
|
635
|
+
}
|
|
636
|
+
if (
|
|
637
|
+
definition &&
|
|
638
|
+
typeof definition === "object" &&
|
|
639
|
+
!Array.isArray(definition)
|
|
640
|
+
) {
|
|
641
|
+
const entries = Object.entries(definition)
|
|
642
|
+
.filter(([, value]) => value !== undefined)
|
|
643
|
+
.map(([key, value]): [string, unknown] => [
|
|
644
|
+
key,
|
|
645
|
+
key === "command" && typeof value === "string"
|
|
646
|
+
? normalizeTaskCommand(value)
|
|
647
|
+
: value,
|
|
648
|
+
])
|
|
649
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));
|
|
650
|
+
if (
|
|
651
|
+
entries.length === 1 &&
|
|
652
|
+
entries[0][0] === "command" &&
|
|
653
|
+
typeof entries[0][1] === "string"
|
|
654
|
+
) {
|
|
655
|
+
return JSON.stringify(entries[0][1]);
|
|
656
|
+
}
|
|
657
|
+
return JSON.stringify(Object.fromEntries(entries));
|
|
658
|
+
}
|
|
659
|
+
return JSON.stringify(definition ?? null);
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/** Versioned hash of {@link canonicalizeManagedTaskDefinition}, as recorded. */
|
|
663
|
+
export function hashManagedTaskDefinition(definition: unknown) {
|
|
664
|
+
return versionedHash(canonicalizeManagedTaskDefinition(definition));
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Classifies a task's current definition against Loom's value, with the same
|
|
669
|
+
* states as {@link classifyManagedFile}: `undefined` is `missing`.
|
|
670
|
+
*/
|
|
671
|
+
export function classifyManagedTask(
|
|
672
|
+
current: unknown,
|
|
673
|
+
expected: unknown,
|
|
674
|
+
proof: ManagedTaskProof = {},
|
|
675
|
+
): { expectedHash: string; state: ManagedFileState } {
|
|
676
|
+
const expectedHash = hashManagedTaskDefinition(expected);
|
|
677
|
+
if (current === undefined) return { expectedHash, state: "missing" };
|
|
678
|
+
const currentHash = hashManagedTaskDefinition(current);
|
|
679
|
+
if (currentHash === expectedHash) return { expectedHash, state: "current" };
|
|
680
|
+
const recordedHash = currentRecordedHash(proof.recordedHash);
|
|
681
|
+
const proven =
|
|
682
|
+
recordedHash !== undefined
|
|
683
|
+
? recordedHash === currentHash
|
|
684
|
+
: (proof.knownValues?.some(
|
|
685
|
+
(value) => hashManagedTaskDefinition(value) === currentHash,
|
|
686
|
+
) ?? false);
|
|
687
|
+
return { expectedHash, state: proven ? "loom-output" : "customized" };
|
|
688
|
+
}
|