@gadicc/loom 1.37.0 → 2.0.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/.loom-source-manifest.json +97 -0
- package/README.md +113 -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 +35 -30
- 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 +9 -6
- package/esm/src/cli/migrationEnv.js.map +1 -0
- package/esm/src/cli/mod.d.ts +20 -7
- package/esm/src/cli/mod.d.ts.map +1 -1
- package/esm/src/cli/mod.js +2148 -730
- 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 +44 -21
- package/esm/src/cli/vercelBuildEnv.js.map +1 -0
- package/esm/src/cli/vercelEnvMask.d.ts +38 -0
- package/esm/src/cli/vercelEnvMask.d.ts.map +1 -0
- package/esm/src/cli/vercelEnvMask.js +140 -0
- 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 +47 -24
- package/esm/src/cli/vercelProjectRelease.js.map +1 -0
- package/esm/src/cli/vercelPulledEnv.d.ts +65 -0
- package/esm/src/cli/vercelPulledEnv.d.ts.map +1 -0
- package/esm/src/cli/vercelPulledEnv.js +133 -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/dependency-upgrades.md +4 -0
- package/skills/loom/references/esm-package.md +35 -0
- package/skills/loom/references/local-development.md +261 -29
- package/skills/loom/references/release-safety.md +10 -3
- package/skills/loom-auth/references/secrets-and-rotation.md +2 -1
- package/skills/loom-mail/SKILL.md +1 -0
- package/skills/loom-scaffold/references/greenfield-workflow.md +2 -1
- 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 +26788 -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 -581
- package/script/src/cli/mod.d.ts.map +0 -1
- package/script/src/cli/mod.js +0 -16850
- 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 -401
- 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/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,1102 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import {
|
|
3
|
+
copyFile,
|
|
4
|
+
lstat,
|
|
5
|
+
mkdir,
|
|
6
|
+
mkdtemp,
|
|
7
|
+
readdir,
|
|
8
|
+
readFile,
|
|
9
|
+
readlink,
|
|
10
|
+
rename,
|
|
11
|
+
rm,
|
|
12
|
+
symlink,
|
|
13
|
+
unlink,
|
|
14
|
+
writeFile,
|
|
15
|
+
} from "node:fs/promises";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
17
|
+
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
18
|
+
import process from "node:process";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
type ExternalSkill,
|
|
22
|
+
getAllExternalSkills,
|
|
23
|
+
getRecommendedExternalSkills,
|
|
24
|
+
} from "./externalSkills.ts";
|
|
25
|
+
|
|
26
|
+
export const LOOM_SKILLS_LOCK = "loom-skills.lock.json";
|
|
27
|
+
export const LOOM_EXTERNAL_SKILLS_CACHE = ".loom/skills";
|
|
28
|
+
export const LOOM_EXTERNAL_SKILLS_GITIGNORE_LINE = ".loom/skills/";
|
|
29
|
+
const LEGACY_EXTERNAL_TARGET_FRAGMENT =
|
|
30
|
+
"/node_modules/@gadicc/loom/skills/recommended/";
|
|
31
|
+
|
|
32
|
+
type PackageJson = {
|
|
33
|
+
dependencies?: Record<string, string>;
|
|
34
|
+
devDependencies?: Record<string, string>;
|
|
35
|
+
name?: string;
|
|
36
|
+
packageManager?: string;
|
|
37
|
+
version?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type ExternalLockEntry = {
|
|
41
|
+
contentHash: string;
|
|
42
|
+
kind: "external";
|
|
43
|
+
licenseAcknowledged?: boolean;
|
|
44
|
+
licenseStatus: ExternalSkill["license"]["status"];
|
|
45
|
+
repositoryUrl: string;
|
|
46
|
+
revision: string;
|
|
47
|
+
sourcePath: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type PackageLockEntry = {
|
|
51
|
+
contentHash: string;
|
|
52
|
+
kind: "package";
|
|
53
|
+
packageName: string;
|
|
54
|
+
packageVersion?: string;
|
|
55
|
+
sourcePath: string;
|
|
56
|
+
/** Committed approved instruction snapshot; absent on legacy live-package records. */
|
|
57
|
+
cachePath?: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type ProjectSkillLockEntry = ExternalLockEntry | PackageLockEntry;
|
|
61
|
+
|
|
62
|
+
export type ProjectSkillsLock = {
|
|
63
|
+
disabled: string[];
|
|
64
|
+
skills: Record<string, ProjectSkillLockEntry>;
|
|
65
|
+
version: 1;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Injectable command boundary used to fetch immutable Git revisions. */
|
|
69
|
+
export type SkillCommandRunner = (
|
|
70
|
+
command: string,
|
|
71
|
+
args: string[],
|
|
72
|
+
options: {
|
|
73
|
+
cwd: string;
|
|
74
|
+
env?: Record<string, string | undefined>;
|
|
75
|
+
stdio?: "inherit" | "pipe";
|
|
76
|
+
},
|
|
77
|
+
) => Promise<{ code: number; stderr: string; stdout: string }>;
|
|
78
|
+
|
|
79
|
+
/** Project signals used to select applicable catalog recommendations. */
|
|
80
|
+
export type ProjectSkillsContext = {
|
|
81
|
+
activeFeatureKeys: Set<string>;
|
|
82
|
+
packageJson: PackageJson;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/** Files and user-facing notices produced by a skill mutation. */
|
|
86
|
+
export type ProjectSkillsMutationResult = {
|
|
87
|
+
changedFiles: string[];
|
|
88
|
+
notes: string[];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** Read-only validation findings for the project skill subsystem. */
|
|
92
|
+
export type ProjectSkillsCheckResult = {
|
|
93
|
+
issues: string[];
|
|
94
|
+
suggestions: string[];
|
|
95
|
+
warnings: string[];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** Display-oriented state for external and package-provided project skills. */
|
|
99
|
+
export type ProjectSkillStatus = {
|
|
100
|
+
disabled: string[];
|
|
101
|
+
external: Array<{
|
|
102
|
+
adopted: boolean;
|
|
103
|
+
applicable: boolean;
|
|
104
|
+
installed: boolean;
|
|
105
|
+
licenseStatus: ExternalSkill["license"]["status"];
|
|
106
|
+
skillName: string;
|
|
107
|
+
revision: string;
|
|
108
|
+
}>;
|
|
109
|
+
packageSkills: Array<{
|
|
110
|
+
active: boolean;
|
|
111
|
+
disabled: boolean;
|
|
112
|
+
packageName: string;
|
|
113
|
+
skillName: string;
|
|
114
|
+
}>;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
type DiscoveredPackageSkill = {
|
|
118
|
+
contentHash: string;
|
|
119
|
+
packageName: string;
|
|
120
|
+
packageVersion?: string;
|
|
121
|
+
path: string;
|
|
122
|
+
selector: string;
|
|
123
|
+
skillName: string;
|
|
124
|
+
sourcePath: string;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
function emptyLock(): ProjectSkillsLock {
|
|
128
|
+
return { disabled: [], skills: {}, version: 1 };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function pathExists(path: string) {
|
|
132
|
+
try {
|
|
133
|
+
await lstat(path);
|
|
134
|
+
return true;
|
|
135
|
+
} catch (error) {
|
|
136
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function readJsonIfExists<T>(path: string): Promise<T | null> {
|
|
142
|
+
try {
|
|
143
|
+
return JSON.parse(await readFile(path, "utf8")) as T;
|
|
144
|
+
} catch (error) {
|
|
145
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return null;
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Reads the committed project skill policy, returning an empty v1 policy when absent. */
|
|
151
|
+
export async function readProjectSkillsLock(
|
|
152
|
+
cwd: string,
|
|
153
|
+
): Promise<ProjectSkillsLock> {
|
|
154
|
+
const lock = await readJsonIfExists<ProjectSkillsLock>(
|
|
155
|
+
join(cwd, LOOM_SKILLS_LOCK),
|
|
156
|
+
);
|
|
157
|
+
if (!lock) return emptyLock();
|
|
158
|
+
if (lock.version !== 1 || !lock.skills || !Array.isArray(lock.disabled)) {
|
|
159
|
+
throw new Error(`Unsupported or invalid ${LOOM_SKILLS_LOCK}.`);
|
|
160
|
+
}
|
|
161
|
+
return lock;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function stableLock(lock: ProjectSkillsLock): ProjectSkillsLock {
|
|
165
|
+
return {
|
|
166
|
+
disabled: [...new Set(lock.disabled)].sort(),
|
|
167
|
+
skills: Object.fromEntries(
|
|
168
|
+
Object.entries(lock.skills).sort(([left], [right]) =>
|
|
169
|
+
left.localeCompare(right),
|
|
170
|
+
),
|
|
171
|
+
),
|
|
172
|
+
version: 1,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function canonicalLock(lock: ProjectSkillsLock) {
|
|
177
|
+
return JSON.stringify(stableLock(lock));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
async function writeLockIfChanged(cwd: string, lock: ProjectSkillsLock) {
|
|
181
|
+
const path = join(cwd, LOOM_SKILLS_LOCK);
|
|
182
|
+
const stable = stableLock(lock);
|
|
183
|
+
const text = `${JSON.stringify(stable, null, 2)}\n`;
|
|
184
|
+
let current: string | null = null;
|
|
185
|
+
try {
|
|
186
|
+
current = await readFile(path, "utf8");
|
|
187
|
+
} catch (error) {
|
|
188
|
+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
189
|
+
}
|
|
190
|
+
if (current === text) return false;
|
|
191
|
+
if (current !== null) {
|
|
192
|
+
try {
|
|
193
|
+
// Formatting belongs to the consumer. Only rewrite the lock when its
|
|
194
|
+
// stable data changes, so project formatters cannot create a sync loop.
|
|
195
|
+
if (
|
|
196
|
+
canonicalLock(JSON.parse(current) as ProjectSkillsLock) ===
|
|
197
|
+
canonicalLock(stable)
|
|
198
|
+
) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
} catch {
|
|
202
|
+
// Invalid lock content is handled by the normal rewrite path below.
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
await writeFile(path, text, "utf8");
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function collectSkillFiles(
|
|
210
|
+
root: string,
|
|
211
|
+
current: string,
|
|
212
|
+
files: Array<{ content: Uint8Array; relativePath: string }>,
|
|
213
|
+
) {
|
|
214
|
+
for (const entry of await readdir(current, { withFileTypes: true })) {
|
|
215
|
+
const path = join(current, entry.name);
|
|
216
|
+
if (entry.isDirectory()) {
|
|
217
|
+
if (entry.name !== ".git" && entry.name !== "node_modules") {
|
|
218
|
+
await collectSkillFiles(root, path, files);
|
|
219
|
+
}
|
|
220
|
+
} else if (entry.isFile()) {
|
|
221
|
+
files.push({
|
|
222
|
+
content: await readFile(path),
|
|
223
|
+
relativePath: relative(root, path).split(sep).join("/"),
|
|
224
|
+
});
|
|
225
|
+
} else if (entry.isSymbolicLink()) {
|
|
226
|
+
throw new Error(`Skill directories may not contain symlinks: ${path}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Computes Loom's deterministic path-and-content digest for one skill tree. */
|
|
232
|
+
export async function computeSkillContentHash(skillPath: string) {
|
|
233
|
+
const files: Array<{ content: Uint8Array; relativePath: string }> = [];
|
|
234
|
+
await collectSkillFiles(skillPath, skillPath, files);
|
|
235
|
+
files.sort((left, right) =>
|
|
236
|
+
left.relativePath.localeCompare(right.relativePath),
|
|
237
|
+
);
|
|
238
|
+
const hash = createHash("sha256");
|
|
239
|
+
for (const file of files) {
|
|
240
|
+
hash.update(file.relativePath);
|
|
241
|
+
hash.update(file.content);
|
|
242
|
+
}
|
|
243
|
+
return hash.digest("hex");
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async function parseSkillName(skillFile: string) {
|
|
247
|
+
try {
|
|
248
|
+
const text = await readFile(skillFile, "utf8");
|
|
249
|
+
const frontmatter = text.match(/^---\s*\n([\s\S]*?)\n---(?:\s*\n|$)/)?.[1];
|
|
250
|
+
const name = frontmatter?.match(/^name:\s*["']?([^\s"']+)["']?\s*$/m)?.[1];
|
|
251
|
+
return name && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name) ? name : null;
|
|
252
|
+
} catch (error) {
|
|
253
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return null;
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async function packageRoots(nodeModules: string) {
|
|
259
|
+
const roots: Array<{ packageName: string; path: string }> = [];
|
|
260
|
+
let entries;
|
|
261
|
+
try {
|
|
262
|
+
entries = await readdir(nodeModules, { withFileTypes: true });
|
|
263
|
+
} catch (error) {
|
|
264
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return roots;
|
|
265
|
+
throw error;
|
|
266
|
+
}
|
|
267
|
+
for (const entry of entries) {
|
|
268
|
+
if (entry.name.startsWith(".")) continue;
|
|
269
|
+
const path = join(nodeModules, entry.name);
|
|
270
|
+
if (entry.name.startsWith("@")) {
|
|
271
|
+
let scopedEntries;
|
|
272
|
+
try {
|
|
273
|
+
scopedEntries = await readdir(path, { withFileTypes: true });
|
|
274
|
+
} catch {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
for (const scoped of scopedEntries) {
|
|
278
|
+
roots.push({
|
|
279
|
+
packageName: `${entry.name}/${scoped.name}`,
|
|
280
|
+
path: join(path, scoped.name),
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
roots.push({ packageName: entry.name, path });
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return roots;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
async function discoverPackageSkills(cwd: string) {
|
|
291
|
+
const found: DiscoveredPackageSkill[] = [];
|
|
292
|
+
for (const root of await packageRoots(join(cwd, "node_modules"))) {
|
|
293
|
+
if (root.packageName === "@gadicc/loom") continue;
|
|
294
|
+
const packageJson = await readJsonIfExists<PackageJson>(
|
|
295
|
+
join(root.path, "package.json"),
|
|
296
|
+
);
|
|
297
|
+
if (!packageJson) continue;
|
|
298
|
+
const candidates = [
|
|
299
|
+
root.path,
|
|
300
|
+
join(root.path, "skills"),
|
|
301
|
+
join(root.path, ".agents", "skills"),
|
|
302
|
+
];
|
|
303
|
+
const rootName = await parseSkillName(join(root.path, "SKILL.md"));
|
|
304
|
+
if (rootName) {
|
|
305
|
+
const contentHash = await computeSkillContentHash(root.path);
|
|
306
|
+
found.push({
|
|
307
|
+
contentHash,
|
|
308
|
+
packageName: root.packageName,
|
|
309
|
+
packageVersion: packageJson.version,
|
|
310
|
+
path: root.path,
|
|
311
|
+
selector: `npm:${root.packageName}:${rootName}`,
|
|
312
|
+
skillName: rootName,
|
|
313
|
+
sourcePath: relative(cwd, root.path),
|
|
314
|
+
});
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
for (const candidate of candidates) {
|
|
318
|
+
let entries;
|
|
319
|
+
try {
|
|
320
|
+
entries = await readdir(candidate, { withFileTypes: true });
|
|
321
|
+
} catch {
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
for (const entry of entries) {
|
|
325
|
+
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
|
|
326
|
+
const skillPath = join(candidate, entry.name);
|
|
327
|
+
const skillName = await parseSkillName(join(skillPath, "SKILL.md"));
|
|
328
|
+
if (!skillName) continue;
|
|
329
|
+
found.push({
|
|
330
|
+
contentHash: await computeSkillContentHash(skillPath),
|
|
331
|
+
packageName: root.packageName,
|
|
332
|
+
packageVersion: packageJson.version,
|
|
333
|
+
path: skillPath,
|
|
334
|
+
selector: `npm:${root.packageName}:${skillName}`,
|
|
335
|
+
skillName,
|
|
336
|
+
sourcePath: relative(cwd, skillPath),
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return found.sort(
|
|
342
|
+
(left, right) =>
|
|
343
|
+
left.skillName.localeCompare(right.skillName) ||
|
|
344
|
+
left.packageName.localeCompare(right.packageName),
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function projectSkillPath(cwd: string, skillName: string) {
|
|
349
|
+
return join(cwd, ".agents", "skills", skillName);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
async function linkState(path: string, expectedTarget: string) {
|
|
353
|
+
try {
|
|
354
|
+
const info = await lstat(path);
|
|
355
|
+
if (!info.isSymbolicLink()) return "custom" as const;
|
|
356
|
+
const target = await readlink(path);
|
|
357
|
+
const resolved = resolve(dirname(path), target);
|
|
358
|
+
if (resolved === resolve(expectedTarget)) return "expected" as const;
|
|
359
|
+
if (
|
|
360
|
+
resolved.split(sep).join("/").includes(LEGACY_EXTERNAL_TARGET_FRAGMENT)
|
|
361
|
+
) {
|
|
362
|
+
return "legacy" as const;
|
|
363
|
+
}
|
|
364
|
+
return "custom" as const;
|
|
365
|
+
} catch (error) {
|
|
366
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
|
|
367
|
+
return "missing" as const;
|
|
368
|
+
}
|
|
369
|
+
throw error;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
async function ensureSkillLink(
|
|
374
|
+
cwd: string,
|
|
375
|
+
skillName: string,
|
|
376
|
+
target: string,
|
|
377
|
+
allowLegacyReplacement: boolean,
|
|
378
|
+
previousTarget?: string,
|
|
379
|
+
) {
|
|
380
|
+
const path = projectSkillPath(cwd, skillName);
|
|
381
|
+
let state = await linkState(path, target);
|
|
382
|
+
if (
|
|
383
|
+
state === "custom" &&
|
|
384
|
+
previousTarget &&
|
|
385
|
+
(await linkState(path, previousTarget)) === "expected"
|
|
386
|
+
) {
|
|
387
|
+
state = "legacy";
|
|
388
|
+
}
|
|
389
|
+
if (state === "expected") return { changed: false, preserved: false };
|
|
390
|
+
if (
|
|
391
|
+
state === "custom" ||
|
|
392
|
+
(state === "legacy" && !allowLegacyReplacement && !previousTarget)
|
|
393
|
+
) {
|
|
394
|
+
return { changed: false, preserved: true };
|
|
395
|
+
}
|
|
396
|
+
if (state === "legacy") await unlink(path);
|
|
397
|
+
await mkdir(dirname(path), { recursive: true });
|
|
398
|
+
await symlink(relative(dirname(path), target), path, "dir");
|
|
399
|
+
return { changed: true, preserved: false };
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
async function removeManagedLink(
|
|
403
|
+
cwd: string,
|
|
404
|
+
skillName: string,
|
|
405
|
+
target: string,
|
|
406
|
+
) {
|
|
407
|
+
const path = projectSkillPath(cwd, skillName);
|
|
408
|
+
if ((await linkState(path, target)) !== "expected") return false;
|
|
409
|
+
await unlink(path);
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
async function removeLegacyPackagedSkillLink(cwd: string, skillName: string) {
|
|
414
|
+
const path = projectSkillPath(cwd, skillName);
|
|
415
|
+
try {
|
|
416
|
+
const info = await lstat(path);
|
|
417
|
+
if (!info.isSymbolicLink()) return false;
|
|
418
|
+
const target = resolve(dirname(path), await readlink(path))
|
|
419
|
+
.split(sep)
|
|
420
|
+
.join("/");
|
|
421
|
+
if (!target.includes(`${LEGACY_EXTERNAL_TARGET_FRAGMENT}${skillName}`)) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
424
|
+
await unlink(path);
|
|
425
|
+
return true;
|
|
426
|
+
} catch (error) {
|
|
427
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
|
|
428
|
+
throw error;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function packageSnapshotPath(
|
|
433
|
+
cwd: string,
|
|
434
|
+
name: string,
|
|
435
|
+
entry: { packageName: string; contentHash: string },
|
|
436
|
+
) {
|
|
437
|
+
return join(
|
|
438
|
+
cwd,
|
|
439
|
+
"loom-skills",
|
|
440
|
+
"npm",
|
|
441
|
+
encodeURIComponent(entry.packageName),
|
|
442
|
+
encodeURIComponent(name),
|
|
443
|
+
entry.contentHash,
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function packageSkillTarget(cwd: string, entry: PackageLockEntry) {
|
|
448
|
+
return resolve(cwd, entry.cachePath ?? entry.sourcePath);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/** Restores recorded npm skills; named adoption or updates require explicit selection. */
|
|
452
|
+
export async function syncInstalledPackageSkills(
|
|
453
|
+
cwd: string,
|
|
454
|
+
options: { skillNames?: string[]; update?: boolean } = {},
|
|
455
|
+
): Promise<ProjectSkillsMutationResult> {
|
|
456
|
+
const changedFiles: string[] = [];
|
|
457
|
+
const notes: string[] = [];
|
|
458
|
+
const hadLock = await pathExists(join(cwd, LOOM_SKILLS_LOCK));
|
|
459
|
+
const lock = await readProjectSkillsLock(cwd);
|
|
460
|
+
const discovered = await discoverPackageSkills(cwd);
|
|
461
|
+
const selected = new Set(options.skillNames ?? []);
|
|
462
|
+
for (const name of selected) {
|
|
463
|
+
const recorded = lock.skills[name];
|
|
464
|
+
const matches = discovered.filter(
|
|
465
|
+
(skill) =>
|
|
466
|
+
skill.skillName === name &&
|
|
467
|
+
(recorded?.kind !== "package" ||
|
|
468
|
+
skill.packageName === recorded.packageName),
|
|
469
|
+
);
|
|
470
|
+
if (matches.length !== 1) {
|
|
471
|
+
throw new Error(
|
|
472
|
+
`npm skill ${name} must have exactly one installed source.`,
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const claimedNames = new Set<string>();
|
|
477
|
+
for (const skill of discovered) {
|
|
478
|
+
if (lock.disabled.includes(skill.selector)) continue;
|
|
479
|
+
const existing = lock.skills[skill.skillName];
|
|
480
|
+
if (existing?.kind === "external") continue;
|
|
481
|
+
if (
|
|
482
|
+
existing?.kind === "package" &&
|
|
483
|
+
existing.packageName !== skill.packageName
|
|
484
|
+
)
|
|
485
|
+
continue;
|
|
486
|
+
if (claimedNames.has(skill.skillName)) continue;
|
|
487
|
+
claimedNames.add(skill.skillName);
|
|
488
|
+
const adopt =
|
|
489
|
+
selected.has(skill.skillName) ||
|
|
490
|
+
(options.update && existing?.kind === "package" && !selected.size);
|
|
491
|
+
if (!existing && !adopt) {
|
|
492
|
+
notes.push(
|
|
493
|
+
`Available npm skill ${skill.skillName} from ${skill.packageName}; review then run \`loom skills add ${skill.skillName}\` or disable it.`,
|
|
494
|
+
);
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
const approved = existing?.kind === "package" ? existing : undefined;
|
|
498
|
+
if (approved && approved.contentHash !== skill.contentHash && !adopt) {
|
|
499
|
+
notes.push(
|
|
500
|
+
`npm skill ${skill.skillName} has changed; sync keeps its recorded content. Review then run \`loom skills update ${skill.skillName}\`.`,
|
|
501
|
+
);
|
|
502
|
+
// Keep a frozen snapshot active even after its supplying package changes.
|
|
503
|
+
if (
|
|
504
|
+
approved.cachePath &&
|
|
505
|
+
(await pathExists(
|
|
506
|
+
join(packageSkillTarget(cwd, approved), "SKILL.md"),
|
|
507
|
+
)) &&
|
|
508
|
+
(await computeSkillContentHash(packageSkillTarget(cwd, approved))) ===
|
|
509
|
+
approved.contentHash
|
|
510
|
+
) {
|
|
511
|
+
const linked = await ensureSkillLink(
|
|
512
|
+
cwd,
|
|
513
|
+
skill.skillName,
|
|
514
|
+
packageSkillTarget(cwd, approved),
|
|
515
|
+
false,
|
|
516
|
+
);
|
|
517
|
+
if (linked.changed) {
|
|
518
|
+
changedFiles.push(
|
|
519
|
+
relative(cwd, projectSkillPath(cwd, skill.skillName)),
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
const destination = packageSnapshotPath(cwd, skill.skillName, skill);
|
|
526
|
+
if (
|
|
527
|
+
!(await pathExists(join(destination, "SKILL.md"))) ||
|
|
528
|
+
(await computeSkillContentHash(destination)) !== skill.contentHash
|
|
529
|
+
) {
|
|
530
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
531
|
+
const partial = await mkdtemp(join(dirname(destination), ".partial-"));
|
|
532
|
+
try {
|
|
533
|
+
await copySkillDirectory(skill.path, partial);
|
|
534
|
+
if ((await computeSkillContentHash(partial)) !== skill.contentHash) {
|
|
535
|
+
throw new Error(
|
|
536
|
+
`npm skill changed during adoption: ${skill.skillName}`,
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
540
|
+
await rm(destination, { recursive: true, force: true });
|
|
541
|
+
await rename(partial, destination);
|
|
542
|
+
changedFiles.push(relative(cwd, destination));
|
|
543
|
+
} finally {
|
|
544
|
+
await rm(partial, { recursive: true, force: true });
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
const linked = await ensureSkillLink(
|
|
548
|
+
cwd,
|
|
549
|
+
skill.skillName,
|
|
550
|
+
destination,
|
|
551
|
+
false,
|
|
552
|
+
approved ? packageSkillTarget(cwd, approved) : undefined,
|
|
553
|
+
);
|
|
554
|
+
if (linked.preserved) {
|
|
555
|
+
notes.push(`Preserved custom skill path for ${skill.skillName}.`);
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
lock.skills[skill.skillName] = {
|
|
559
|
+
kind: "package",
|
|
560
|
+
packageName: skill.packageName,
|
|
561
|
+
packageVersion: skill.packageVersion,
|
|
562
|
+
contentHash: skill.contentHash,
|
|
563
|
+
sourcePath: skill.sourcePath,
|
|
564
|
+
cachePath: relative(cwd, destination),
|
|
565
|
+
};
|
|
566
|
+
if (linked.changed) {
|
|
567
|
+
changedFiles.push(relative(cwd, projectSkillPath(cwd, skill.skillName)));
|
|
568
|
+
}
|
|
569
|
+
if (adopt) {
|
|
570
|
+
notes.push(
|
|
571
|
+
`Adopted npm skill ${skill.skillName} from ${skill.packageName} at ${skill.contentHash.slice(
|
|
572
|
+
0,
|
|
573
|
+
12,
|
|
574
|
+
)}. Disable with \`loom skills disable ${skill.skillName}\`.`,
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
for (const [name, entry] of Object.entries(lock.skills)) {
|
|
579
|
+
if (
|
|
580
|
+
entry.kind !== "package" ||
|
|
581
|
+
!entry.cachePath ||
|
|
582
|
+
lock.disabled.includes(`npm:${entry.packageName}:${name}`)
|
|
583
|
+
)
|
|
584
|
+
continue;
|
|
585
|
+
const target = packageSkillTarget(cwd, entry);
|
|
586
|
+
if (
|
|
587
|
+
!(await pathExists(join(target, "SKILL.md"))) ||
|
|
588
|
+
(await computeSkillContentHash(target)) !== entry.contentHash
|
|
589
|
+
)
|
|
590
|
+
continue;
|
|
591
|
+
const linked = await ensureSkillLink(cwd, name, target, false);
|
|
592
|
+
if (linked.changed) {
|
|
593
|
+
changedFiles.push(relative(cwd, projectSkillPath(cwd, name)));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (
|
|
597
|
+
(hadLock || Object.keys(lock.skills).length > 0) &&
|
|
598
|
+
(await writeLockIfChanged(cwd, lock))
|
|
599
|
+
)
|
|
600
|
+
changedFiles.push(LOOM_SKILLS_LOCK);
|
|
601
|
+
return { changedFiles: [...new Set(changedFiles)], notes };
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
async function runGit(
|
|
605
|
+
runner: SkillCommandRunner,
|
|
606
|
+
args: string[],
|
|
607
|
+
cwd: string,
|
|
608
|
+
env: Record<string, string | undefined>,
|
|
609
|
+
) {
|
|
610
|
+
const result = await runner("git", args, { cwd, env, stdio: "pipe" });
|
|
611
|
+
if (result.code !== 0) {
|
|
612
|
+
throw new Error(
|
|
613
|
+
`git ${args.join(" ")} failed: ${result.stderr.trim() || result.code}`,
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
async function checkoutExternalSource(
|
|
619
|
+
skill: ExternalSkill,
|
|
620
|
+
checkoutRoot: string,
|
|
621
|
+
runner: SkillCommandRunner,
|
|
622
|
+
env: Record<string, string | undefined>,
|
|
623
|
+
) {
|
|
624
|
+
const checkout = join(
|
|
625
|
+
checkoutRoot,
|
|
626
|
+
`${skill.skillName}-${skill.source.revision.slice(0, 12)}`,
|
|
627
|
+
);
|
|
628
|
+
await mkdir(checkout, { recursive: true });
|
|
629
|
+
await runGit(runner, ["init", "--quiet"], checkout, env);
|
|
630
|
+
await runGit(
|
|
631
|
+
runner,
|
|
632
|
+
["remote", "add", "origin", skill.source.repositoryUrl],
|
|
633
|
+
checkout,
|
|
634
|
+
env,
|
|
635
|
+
);
|
|
636
|
+
await runGit(
|
|
637
|
+
runner,
|
|
638
|
+
["fetch", "--depth", "1", "origin", skill.source.revision],
|
|
639
|
+
checkout,
|
|
640
|
+
env,
|
|
641
|
+
);
|
|
642
|
+
await runGit(runner, ["checkout", "--detach", "FETCH_HEAD"], checkout, env);
|
|
643
|
+
const sourcePath = resolve(checkout, skill.source.sourcePath);
|
|
644
|
+
if (
|
|
645
|
+
sourcePath !== resolve(checkout) &&
|
|
646
|
+
!sourcePath.startsWith(`${resolve(checkout)}${sep}`)
|
|
647
|
+
) {
|
|
648
|
+
throw new Error(
|
|
649
|
+
`External skill path escapes its checkout: ${skill.skillName}`,
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
if (!(await parseSkillName(join(sourcePath, "SKILL.md")))) {
|
|
653
|
+
throw new Error(`External skill has no valid SKILL.md: ${skill.skillName}`);
|
|
654
|
+
}
|
|
655
|
+
return sourcePath;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
async function copySkillDirectory(source: string, destination: string) {
|
|
659
|
+
await mkdir(destination, { recursive: true });
|
|
660
|
+
for (const entry of await readdir(source, { withFileTypes: true })) {
|
|
661
|
+
const from = join(source, entry.name);
|
|
662
|
+
const to = join(destination, entry.name);
|
|
663
|
+
if (
|
|
664
|
+
entry.isDirectory() &&
|
|
665
|
+
(entry.name === ".git" || entry.name === "node_modules")
|
|
666
|
+
)
|
|
667
|
+
continue;
|
|
668
|
+
if (entry.isDirectory()) await copySkillDirectory(from, to);
|
|
669
|
+
else if (entry.isFile()) await copyFile(from, to);
|
|
670
|
+
else throw new Error(`External skill contains unsupported link: ${from}`);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
function externalCachePath(cwd: string, skill: ExternalSkill) {
|
|
675
|
+
return join(
|
|
676
|
+
cwd,
|
|
677
|
+
LOOM_EXTERNAL_SKILLS_CACHE,
|
|
678
|
+
skill.skillName,
|
|
679
|
+
skill.source.revision,
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
async function hydrateExternalSkill(
|
|
684
|
+
cwd: string,
|
|
685
|
+
skill: ExternalSkill,
|
|
686
|
+
runner: SkillCommandRunner,
|
|
687
|
+
env: Record<string, string | undefined>,
|
|
688
|
+
) {
|
|
689
|
+
const destination = externalCachePath(cwd, skill);
|
|
690
|
+
if (await pathExists(join(destination, "SKILL.md"))) {
|
|
691
|
+
const currentHash = await computeSkillContentHash(destination);
|
|
692
|
+
if (currentHash === skill.source.contentHash) return false;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
const checkoutRoot = await mkdtemp(join(tmpdir(), "loom-skill-checkout-"));
|
|
696
|
+
const partial = `${destination}.partial-${process.pid}`;
|
|
697
|
+
try {
|
|
698
|
+
const sourcePath = await checkoutExternalSource(
|
|
699
|
+
skill,
|
|
700
|
+
checkoutRoot,
|
|
701
|
+
runner,
|
|
702
|
+
env,
|
|
703
|
+
);
|
|
704
|
+
const hash = await computeSkillContentHash(sourcePath);
|
|
705
|
+
if (hash !== skill.source.contentHash) {
|
|
706
|
+
throw new Error(
|
|
707
|
+
`Content hash mismatch for ${skill.skillName} at ${skill.source.revision}.`,
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
await rm(partial, { force: true, recursive: true });
|
|
711
|
+
await copySkillDirectory(sourcePath, partial);
|
|
712
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
713
|
+
await rm(destination, { force: true, recursive: true });
|
|
714
|
+
await rename(partial, destination);
|
|
715
|
+
return true;
|
|
716
|
+
} finally {
|
|
717
|
+
await rm(partial, { force: true, recursive: true });
|
|
718
|
+
await rm(checkoutRoot, { force: true, recursive: true });
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function lockedExternalSkill(
|
|
723
|
+
name: string,
|
|
724
|
+
entry: ExternalLockEntry,
|
|
725
|
+
catalog?: ExternalSkill,
|
|
726
|
+
): ExternalSkill {
|
|
727
|
+
return {
|
|
728
|
+
skillName: name,
|
|
729
|
+
description: catalog?.description ?? name,
|
|
730
|
+
license: { ...catalog?.license, status: entry.licenseStatus },
|
|
731
|
+
sourceLabel: catalog?.sourceLabel ?? entry.repositoryUrl,
|
|
732
|
+
sourceUrl: catalog?.sourceUrl ?? entry.repositoryUrl,
|
|
733
|
+
source: {
|
|
734
|
+
contentHash: entry.contentHash,
|
|
735
|
+
repositoryUrl: entry.repositoryUrl,
|
|
736
|
+
revision: entry.revision,
|
|
737
|
+
ref: entry.revision,
|
|
738
|
+
sourcePath: entry.sourcePath,
|
|
739
|
+
},
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/** Hydrates selected external skills at catalog-pinned revisions and updates links. */
|
|
744
|
+
export async function syncExternalProjectSkills(
|
|
745
|
+
cwd: string,
|
|
746
|
+
context: ProjectSkillsContext,
|
|
747
|
+
options: {
|
|
748
|
+
acceptUnknownLicense?: string[];
|
|
749
|
+
adoptRecommended?: boolean;
|
|
750
|
+
commandRunner: SkillCommandRunner;
|
|
751
|
+
env?: Record<string, string | undefined>;
|
|
752
|
+
skillNames?: string[];
|
|
753
|
+
skills?: ExternalSkill[];
|
|
754
|
+
/** Explicitly move selected recorded skills to reviewed catalog revisions. */
|
|
755
|
+
update?: boolean;
|
|
756
|
+
},
|
|
757
|
+
): Promise<ProjectSkillsMutationResult> {
|
|
758
|
+
const changedFiles: string[] = [];
|
|
759
|
+
const notes: string[] = [];
|
|
760
|
+
const env = options.env ?? process.env;
|
|
761
|
+
const lock = await readProjectSkillsLock(cwd);
|
|
762
|
+
const all = options.skills ?? getAllExternalSkills();
|
|
763
|
+
const applicable =
|
|
764
|
+
options.skills ??
|
|
765
|
+
getRecommendedExternalSkills(
|
|
766
|
+
context.packageJson,
|
|
767
|
+
context.activeFeatureKeys,
|
|
768
|
+
await pathExists(join(cwd, "pnpm-lock.yaml")),
|
|
769
|
+
);
|
|
770
|
+
const byName = new Map(all.map((skill) => [skill.skillName, skill]));
|
|
771
|
+
const selected = new Set(options.skillNames ?? []);
|
|
772
|
+
if (options.adoptRecommended) {
|
|
773
|
+
for (const skill of applicable) selected.add(skill.skillName);
|
|
774
|
+
}
|
|
775
|
+
for (const [name, entry] of Object.entries(lock.skills)) {
|
|
776
|
+
if (entry.kind === "external") selected.add(name);
|
|
777
|
+
}
|
|
778
|
+
const unknown = [...selected].filter(
|
|
779
|
+
(name) => !byName.has(name) && lock.skills[name]?.kind !== "external",
|
|
780
|
+
);
|
|
781
|
+
if (unknown.length) {
|
|
782
|
+
throw new Error(`Unknown external skill: ${unknown.join(", ")}`);
|
|
783
|
+
}
|
|
784
|
+
const accepted = new Set(options.acceptUnknownLicense ?? []);
|
|
785
|
+
|
|
786
|
+
for (const skillName of [...selected].sort()) {
|
|
787
|
+
const recorded = lock.skills[skillName];
|
|
788
|
+
// Existing provenance wins even if the catalog recommends the same name.
|
|
789
|
+
if (recorded?.kind === "package") continue;
|
|
790
|
+
const catalogSkill = byName.get(skillName);
|
|
791
|
+
const update =
|
|
792
|
+
options.update &&
|
|
793
|
+
(options.skillNames === undefined ||
|
|
794
|
+
options.skillNames.includes(skillName));
|
|
795
|
+
const skill: ExternalSkill =
|
|
796
|
+
recorded?.kind === "external" && !update
|
|
797
|
+
? lockedExternalSkill(skillName, recorded, catalogSkill)
|
|
798
|
+
: catalogSkill!;
|
|
799
|
+
if (!skill) {
|
|
800
|
+
throw new Error(`No reviewed catalog revision for ${skillName}.`);
|
|
801
|
+
}
|
|
802
|
+
const selector = `external:${skillName}`;
|
|
803
|
+
if (lock.disabled.includes(selector)) {
|
|
804
|
+
if (await removeLegacyPackagedSkillLink(cwd, skillName)) {
|
|
805
|
+
changedFiles.push(relative(cwd, projectSkillPath(cwd, skillName)));
|
|
806
|
+
notes.push(
|
|
807
|
+
`Removed legacy packaged link for disabled skill ${skillName}.`,
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
const existing = lock.skills[skillName];
|
|
813
|
+
const acknowledged =
|
|
814
|
+
(existing?.kind === "external" &&
|
|
815
|
+
existing.licenseAcknowledged === true) ||
|
|
816
|
+
accepted.has(skillName);
|
|
817
|
+
if (skill.license.status !== "verified" && !acknowledged) {
|
|
818
|
+
if (await removeLegacyPackagedSkillLink(cwd, skillName)) {
|
|
819
|
+
changedFiles.push(relative(cwd, projectSkillPath(cwd, skillName)));
|
|
820
|
+
notes.push(
|
|
821
|
+
`Removed the legacy packaged ${skillName} link because Loom no longer redistributes its content.`,
|
|
822
|
+
);
|
|
823
|
+
}
|
|
824
|
+
notes.push(
|
|
825
|
+
`Did not install ${skillName}: upstream declares no clear license. Re-run with \`--accept-unknown-license ${skillName}\` after reviewing ${skill.sourceUrl}.`,
|
|
826
|
+
);
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
const hydrated = await hydrateExternalSkill(
|
|
830
|
+
cwd,
|
|
831
|
+
skill,
|
|
832
|
+
options.commandRunner,
|
|
833
|
+
env,
|
|
834
|
+
);
|
|
835
|
+
const target = externalCachePath(cwd, skill);
|
|
836
|
+
const linked = await ensureSkillLink(
|
|
837
|
+
cwd,
|
|
838
|
+
skillName,
|
|
839
|
+
target,
|
|
840
|
+
true,
|
|
841
|
+
existing?.kind === "external"
|
|
842
|
+
? join(cwd, LOOM_EXTERNAL_SKILLS_CACHE, skillName, existing.revision)
|
|
843
|
+
: undefined,
|
|
844
|
+
);
|
|
845
|
+
if (linked.preserved) {
|
|
846
|
+
notes.push(`Preserved custom skill path for ${skillName}.`);
|
|
847
|
+
continue;
|
|
848
|
+
}
|
|
849
|
+
lock.skills[skillName] = {
|
|
850
|
+
contentHash: skill.source.contentHash,
|
|
851
|
+
kind: "external",
|
|
852
|
+
licenseAcknowledged: acknowledged || undefined,
|
|
853
|
+
licenseStatus: skill.license.status,
|
|
854
|
+
repositoryUrl: skill.source.repositoryUrl,
|
|
855
|
+
revision: skill.source.revision,
|
|
856
|
+
sourcePath: skill.source.sourcePath,
|
|
857
|
+
};
|
|
858
|
+
if (hydrated) {
|
|
859
|
+
notes.push(
|
|
860
|
+
`Installed ${skillName} at ${skill.source.revision.slice(0, 12)}.`,
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
if (linked.changed) {
|
|
864
|
+
changedFiles.push(relative(cwd, projectSkillPath(cwd, skillName)));
|
|
865
|
+
notes.push(`Linked external skill ${skillName} from the project cache.`);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
if (await writeLockIfChanged(cwd, lock)) changedFiles.push(LOOM_SKILLS_LOCK);
|
|
870
|
+
return { changedFiles: [...new Set(changedFiles)], notes };
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/** Removes only the retired Next skill symlink created by older Loom releases. */
|
|
874
|
+
export async function removeLegacyNextSkillLink(cwd: string) {
|
|
875
|
+
return await removeLegacyPackagedSkillLink(cwd, "next-best-practices");
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/** Checks package activations and external skill locks, caches, and catalog revisions. */
|
|
879
|
+
export async function checkProjectSkills(
|
|
880
|
+
cwd: string,
|
|
881
|
+
context: ProjectSkillsContext,
|
|
882
|
+
strict = false,
|
|
883
|
+
): Promise<ProjectSkillsCheckResult> {
|
|
884
|
+
const warnings: string[] = [];
|
|
885
|
+
const issues: string[] = [];
|
|
886
|
+
const suggestions = new Set<string>();
|
|
887
|
+
const lock = await readProjectSkillsLock(cwd);
|
|
888
|
+
const discovered = await discoverPackageSkills(cwd);
|
|
889
|
+
for (const skill of discovered) {
|
|
890
|
+
if (lock.disabled.includes(skill.selector)) continue;
|
|
891
|
+
const entry = lock.skills[skill.skillName];
|
|
892
|
+
if (entry?.kind === "external") continue;
|
|
893
|
+
if (entry?.kind !== "package" || entry.packageName !== skill.packageName) {
|
|
894
|
+
warnings.push(
|
|
895
|
+
`Installed npm package ${skill.packageName} provides unadopted skill ${skill.skillName}.`,
|
|
896
|
+
);
|
|
897
|
+
suggestions.add(
|
|
898
|
+
`Review then run \`loom skills add ${skill.skillName}\` or \`loom skills disable ${skill.skillName}\`.`,
|
|
899
|
+
);
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
if (entry.contentHash !== skill.contentHash) {
|
|
903
|
+
warnings.push(
|
|
904
|
+
`npm skill ${skill.skillName} differs from its recorded content; review before updating.`,
|
|
905
|
+
);
|
|
906
|
+
suggestions.add(
|
|
907
|
+
`Review then run \`loom skills update ${skill.skillName}\`.`,
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
for (const [name, entry] of Object.entries(lock.skills)) {
|
|
912
|
+
if (
|
|
913
|
+
entry.kind !== "package" ||
|
|
914
|
+
lock.disabled.includes(`npm:${entry.packageName}:${name}`)
|
|
915
|
+
)
|
|
916
|
+
continue;
|
|
917
|
+
const target = packageSkillTarget(cwd, entry);
|
|
918
|
+
const present = await pathExists(join(target, "SKILL.md"));
|
|
919
|
+
if (
|
|
920
|
+
!present ||
|
|
921
|
+
(await linkState(projectSkillPath(cwd, name), target)) !== "expected"
|
|
922
|
+
) {
|
|
923
|
+
(strict ? issues : warnings).push(
|
|
924
|
+
`Recorded npm skill is not hydrated and linked: ${name}.`,
|
|
925
|
+
);
|
|
926
|
+
suggestions.add("Run `loom skills sync` to restore recorded skills.");
|
|
927
|
+
} else if ((await computeSkillContentHash(target)) !== entry.contentHash) {
|
|
928
|
+
(strict ? issues : warnings).push(
|
|
929
|
+
`Recorded npm skill content does not match its approved hash: ${name}.`,
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const applicable = getRecommendedExternalSkills(
|
|
935
|
+
context.packageJson,
|
|
936
|
+
context.activeFeatureKeys,
|
|
937
|
+
await pathExists(join(cwd, "pnpm-lock.yaml")),
|
|
938
|
+
);
|
|
939
|
+
const applicableNames = new Set(applicable.map((skill) => skill.skillName));
|
|
940
|
+
const catalog = new Map(
|
|
941
|
+
getAllExternalSkills().map((skill) => [skill.skillName, skill]),
|
|
942
|
+
);
|
|
943
|
+
const names = new Set(applicableNames);
|
|
944
|
+
for (const [skillName, entry] of Object.entries(lock.skills)) {
|
|
945
|
+
if (entry.kind === "external") names.add(skillName);
|
|
946
|
+
}
|
|
947
|
+
for (const skillName of names) {
|
|
948
|
+
if (lock.disabled.includes(`external:${skillName}`)) continue;
|
|
949
|
+
let skill = catalog.get(skillName);
|
|
950
|
+
const entry = lock.skills[skillName];
|
|
951
|
+
if (!skill) {
|
|
952
|
+
warnings.push(
|
|
953
|
+
`Locked external skill is no longer present in Loom's catalog: ${skillName}.`,
|
|
954
|
+
);
|
|
955
|
+
if (entry?.kind !== "external") continue;
|
|
956
|
+
skill = lockedExternalSkill(skillName, entry);
|
|
957
|
+
}
|
|
958
|
+
if (entry?.kind !== "external") {
|
|
959
|
+
if (!applicableNames.has(skillName)) continue;
|
|
960
|
+
const message =
|
|
961
|
+
skill.license.status === "verified"
|
|
962
|
+
? `Recommended external skill is not adopted: ${skill.skillName} (${skill.sourceLabel}).`
|
|
963
|
+
: `Recommended external skill requires license review before adoption: ${skill.skillName} (${skill.sourceLabel}).`;
|
|
964
|
+
if (strict) {
|
|
965
|
+
warnings.push(message);
|
|
966
|
+
suggestions.add(
|
|
967
|
+
`Review then adopt or disable ${skill.skillName}; adoption is optional.`,
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
const target = join(
|
|
973
|
+
cwd,
|
|
974
|
+
LOOM_EXTERNAL_SKILLS_CACHE,
|
|
975
|
+
skill.skillName,
|
|
976
|
+
entry.revision,
|
|
977
|
+
);
|
|
978
|
+
const state = await linkState(
|
|
979
|
+
projectSkillPath(cwd, skill.skillName),
|
|
980
|
+
target,
|
|
981
|
+
);
|
|
982
|
+
if (state !== "expected" || !(await pathExists(join(target, "SKILL.md")))) {
|
|
983
|
+
(strict ? issues : warnings).push(
|
|
984
|
+
`External skill is not hydrated and linked: ${skill.skillName}.`,
|
|
985
|
+
);
|
|
986
|
+
suggestions.add("Run `loom skills sync`.");
|
|
987
|
+
continue;
|
|
988
|
+
}
|
|
989
|
+
if ((await computeSkillContentHash(target)) !== entry.contentHash) {
|
|
990
|
+
(strict ? issues : warnings).push(
|
|
991
|
+
`External skill content hash mismatch: ${skillName}.`,
|
|
992
|
+
);
|
|
993
|
+
suggestions.add("Run `loom skills sync` to restore recorded skills.");
|
|
994
|
+
}
|
|
995
|
+
if (
|
|
996
|
+
entry.revision !== skill.source.revision ||
|
|
997
|
+
entry.contentHash !== skill.source.contentHash
|
|
998
|
+
) {
|
|
999
|
+
warnings.push(
|
|
1000
|
+
`External skill is behind Loom's reviewed catalog: ${skill.skillName}.`,
|
|
1001
|
+
);
|
|
1002
|
+
suggestions.add(`Run \`loom skills update ${skillName}\`.`);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
return { issues, suggestions: [...suggestions], warnings };
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/** Toggles a project opt-out while retaining recorded adoption for restoration. */
|
|
1009
|
+
export async function setProjectSkillDisabled(
|
|
1010
|
+
cwd: string,
|
|
1011
|
+
skillName: string,
|
|
1012
|
+
disabled: boolean,
|
|
1013
|
+
): Promise<ProjectSkillsMutationResult> {
|
|
1014
|
+
const lock = await readProjectSkillsLock(cwd);
|
|
1015
|
+
const entry = lock.skills[skillName];
|
|
1016
|
+
const packageSelectors = (await discoverPackageSkills(cwd))
|
|
1017
|
+
.filter((skill) => skill.skillName === skillName)
|
|
1018
|
+
.map((skill) => skill.selector);
|
|
1019
|
+
const selectors =
|
|
1020
|
+
entry?.kind === "package"
|
|
1021
|
+
? [`npm:${entry.packageName}:${skillName}`]
|
|
1022
|
+
: entry?.kind === "external"
|
|
1023
|
+
? [`external:${skillName}`]
|
|
1024
|
+
: [...packageSelectors, `external:${skillName}`];
|
|
1025
|
+
if (disabled) lock.disabled.push(...selectors);
|
|
1026
|
+
else {
|
|
1027
|
+
lock.disabled = lock.disabled.filter(
|
|
1028
|
+
(item) => !selectors.includes(item) && !item.endsWith(`:${skillName}`),
|
|
1029
|
+
);
|
|
1030
|
+
}
|
|
1031
|
+
const changedFiles: string[] = [];
|
|
1032
|
+
if (disabled && entry) {
|
|
1033
|
+
const target =
|
|
1034
|
+
entry.kind === "package"
|
|
1035
|
+
? packageSkillTarget(cwd, entry)
|
|
1036
|
+
: join(cwd, LOOM_EXTERNAL_SKILLS_CACHE, skillName, entry.revision);
|
|
1037
|
+
if (await removeManagedLink(cwd, skillName, target)) {
|
|
1038
|
+
changedFiles.push(relative(cwd, projectSkillPath(cwd, skillName)));
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
if (await writeLockIfChanged(cwd, lock)) changedFiles.push(LOOM_SKILLS_LOCK);
|
|
1042
|
+
return {
|
|
1043
|
+
changedFiles,
|
|
1044
|
+
notes: [
|
|
1045
|
+
disabled
|
|
1046
|
+
? `Disabled automatic activation for ${skillName}.`
|
|
1047
|
+
: entry
|
|
1048
|
+
? `Enabled restoration for ${skillName}; run \`loom skills sync\`.`
|
|
1049
|
+
: `Cleared the opt-out for ${skillName}; review then run \`loom skills add ${skillName}\`.`,
|
|
1050
|
+
],
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/** Returns display-oriented project skill status without mutating the project. */
|
|
1055
|
+
export async function getProjectSkillStatus(
|
|
1056
|
+
cwd: string,
|
|
1057
|
+
context: ProjectSkillsContext,
|
|
1058
|
+
): Promise<ProjectSkillStatus> {
|
|
1059
|
+
const lock = await readProjectSkillsLock(cwd);
|
|
1060
|
+
const discovered = await discoverPackageSkills(cwd);
|
|
1061
|
+
const applicable = new Set(
|
|
1062
|
+
getRecommendedExternalSkills(
|
|
1063
|
+
context.packageJson,
|
|
1064
|
+
context.activeFeatureKeys,
|
|
1065
|
+
await pathExists(join(cwd, "pnpm-lock.yaml")),
|
|
1066
|
+
).map((skill) => skill.skillName),
|
|
1067
|
+
);
|
|
1068
|
+
const external = await Promise.all(
|
|
1069
|
+
getAllExternalSkills().map(async (skill) => {
|
|
1070
|
+
const entry = lock.skills[skill.skillName];
|
|
1071
|
+
const installed =
|
|
1072
|
+
entry?.kind === "external" &&
|
|
1073
|
+
(await pathExists(
|
|
1074
|
+
join(
|
|
1075
|
+
cwd,
|
|
1076
|
+
LOOM_EXTERNAL_SKILLS_CACHE,
|
|
1077
|
+
skill.skillName,
|
|
1078
|
+
entry.revision,
|
|
1079
|
+
"SKILL.md",
|
|
1080
|
+
),
|
|
1081
|
+
));
|
|
1082
|
+
return {
|
|
1083
|
+
adopted: entry?.kind === "external",
|
|
1084
|
+
applicable: applicable.has(skill.skillName),
|
|
1085
|
+
installed,
|
|
1086
|
+
licenseStatus: skill.license.status,
|
|
1087
|
+
skillName: skill.skillName,
|
|
1088
|
+
revision: skill.source.revision,
|
|
1089
|
+
};
|
|
1090
|
+
}),
|
|
1091
|
+
);
|
|
1092
|
+
return {
|
|
1093
|
+
disabled: lock.disabled,
|
|
1094
|
+
external,
|
|
1095
|
+
packageSkills: discovered.map((skill) => ({
|
|
1096
|
+
active: lock.skills[skill.skillName]?.kind === "package",
|
|
1097
|
+
disabled: lock.disabled.includes(skill.selector),
|
|
1098
|
+
packageName: skill.packageName,
|
|
1099
|
+
skillName: skill.skillName,
|
|
1100
|
+
})),
|
|
1101
|
+
};
|
|
1102
|
+
}
|