@doist/comms-cli 0.0.1 → 1.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/CHANGELOG.md +8 -0
- package/README.md +165 -29
- package/dist/commands/account/index.d.ts +3 -0
- package/dist/commands/account/index.d.ts.map +1 -0
- package/dist/commands/account/index.js +104 -0
- package/dist/commands/account/index.js.map +1 -0
- package/dist/commands/auth/helpers.d.ts +22 -0
- package/dist/commands/auth/helpers.d.ts.map +1 -0
- package/dist/commands/auth/helpers.js +29 -0
- package/dist/commands/auth/helpers.js.map +1 -0
- package/dist/commands/auth/index.d.ts +3 -0
- package/dist/commands/auth/index.d.ts.map +1 -0
- package/dist/commands/auth/index.js +32 -0
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/auth/login.d.ts +4 -0
- package/dist/commands/auth/login.d.ts.map +1 -0
- package/dist/commands/auth/login.js +29 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +11 -0
- package/dist/commands/auth/logout.d.ts.map +1 -0
- package/dist/commands/auth/logout.js +16 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/status.d.ts +16 -0
- package/dist/commands/auth/status.d.ts.map +1 -0
- package/dist/commands/auth/status.js +102 -0
- package/dist/commands/auth/status.js.map +1 -0
- package/dist/commands/auth/store-wrap.d.ts +4 -0
- package/dist/commands/auth/store-wrap.d.ts.map +1 -0
- package/dist/commands/auth/store-wrap.js +24 -0
- package/dist/commands/auth/store-wrap.js.map +1 -0
- package/dist/commands/auth/token.d.ts +2 -0
- package/dist/commands/auth/token.d.ts.map +1 -0
- package/dist/commands/auth/token.js +56 -0
- package/dist/commands/auth/token.js.map +1 -0
- package/dist/commands/changelog.d.ts +3 -0
- package/dist/commands/changelog.d.ts.map +1 -0
- package/dist/commands/changelog.js +16 -0
- package/dist/commands/changelog.js.map +1 -0
- package/dist/commands/channel/create.d.ts +11 -0
- package/dist/commands/channel/create.d.ts.map +1 -0
- package/dist/commands/channel/create.js +35 -0
- package/dist/commands/channel/create.js.map +1 -0
- package/dist/commands/channel/helpers.d.ts +9 -0
- package/dist/commands/channel/helpers.d.ts.map +1 -0
- package/dist/commands/channel/helpers.js +51 -0
- package/dist/commands/channel/helpers.js.map +1 -0
- package/dist/commands/channel/index.d.ts +3 -0
- package/dist/commands/channel/index.d.ts.map +1 -0
- package/dist/commands/channel/index.js +104 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/channel/list.d.ts +8 -0
- package/dist/commands/channel/list.d.ts.map +1 -0
- package/dist/commands/channel/list.js +144 -0
- package/dist/commands/channel/list.js.map +1 -0
- package/dist/commands/channel/threads.d.ts +11 -0
- package/dist/commands/channel/threads.d.ts.map +1 -0
- package/dist/commands/channel/threads.js +100 -0
- package/dist/commands/channel/threads.js.map +1 -0
- package/dist/commands/channel/update.d.ts +12 -0
- package/dist/commands/channel/update.d.ts.map +1 -0
- package/dist/commands/channel/update.js +84 -0
- package/dist/commands/channel/update.js.map +1 -0
- package/dist/commands/comment/delete.d.ts +5 -0
- package/dist/commands/comment/delete.d.ts.map +1 -0
- package/dist/commands/comment/delete.js +33 -0
- package/dist/commands/comment/delete.js.map +1 -0
- package/dist/commands/comment/index.d.ts +3 -0
- package/dist/commands/comment/index.d.ts.map +1 -0
- package/dist/commands/comment/index.js +49 -0
- package/dist/commands/comment/index.js.map +1 -0
- package/dist/commands/comment/update.d.ts +5 -0
- package/dist/commands/comment/update.d.ts.map +1 -0
- package/dist/commands/comment/update.js +37 -0
- package/dist/commands/comment/update.js.map +1 -0
- package/dist/commands/comment/view.d.ts +3 -0
- package/dist/commands/comment/view.d.ts.map +1 -0
- package/dist/commands/comment/view.js +31 -0
- package/dist/commands/comment/view.js.map +1 -0
- package/dist/commands/completion/helpers.d.ts +14 -0
- package/dist/commands/completion/helpers.d.ts.map +1 -0
- package/dist/commands/completion/helpers.js +37 -0
- package/dist/commands/completion/helpers.js.map +1 -0
- package/dist/commands/completion/index.d.ts +3 -0
- package/dist/commands/completion/index.d.ts.map +1 -0
- package/dist/commands/completion/index.js +22 -0
- package/dist/commands/completion/index.js.map +1 -0
- package/dist/commands/completion/install.d.ts +2 -0
- package/dist/commands/completion/install.d.ts.map +1 -0
- package/dist/commands/completion/install.js +19 -0
- package/dist/commands/completion/install.js.map +1 -0
- package/dist/commands/completion/server.d.ts +3 -0
- package/dist/commands/completion/server.d.ts.map +1 -0
- package/dist/commands/completion/server.js +35 -0
- package/dist/commands/completion/server.js.map +1 -0
- package/dist/commands/completion/uninstall.d.ts +2 -0
- package/dist/commands/completion/uninstall.d.ts.map +1 -0
- package/dist/commands/completion/uninstall.js +19 -0
- package/dist/commands/completion/uninstall.js.map +1 -0
- package/dist/commands/config/index.d.ts +3 -0
- package/dist/commands/config/index.d.ts.map +1 -0
- package/dist/commands/config/index.js +29 -0
- package/dist/commands/config/index.js.map +1 -0
- package/dist/commands/config/set.d.ts +3 -0
- package/dist/commands/config/set.d.ts.map +1 -0
- package/dist/commands/config/set.js +41 -0
- package/dist/commands/config/set.js.map +1 -0
- package/dist/commands/config/view.d.ts +6 -0
- package/dist/commands/config/view.d.ts.map +1 -0
- package/dist/commands/config/view.js +121 -0
- package/dist/commands/config/view.js.map +1 -0
- package/dist/commands/conversation/done.d.ts +3 -0
- package/dist/commands/conversation/done.d.ts.map +1 -0
- package/dist/commands/conversation/done.js +23 -0
- package/dist/commands/conversation/done.js.map +1 -0
- package/dist/commands/conversation/helpers.d.ts +28 -0
- package/dist/commands/conversation/helpers.d.ts.map +1 -0
- package/dist/commands/conversation/helpers.js +119 -0
- package/dist/commands/conversation/helpers.js.map +1 -0
- package/dist/commands/conversation/index.d.ts +3 -0
- package/dist/commands/conversation/index.d.ts.map +1 -0
- package/dist/commands/conversation/index.js +107 -0
- package/dist/commands/conversation/index.js.map +1 -0
- package/dist/commands/conversation/mute.d.ts +3 -0
- package/dist/commands/conversation/mute.d.ts.map +1 -0
- package/dist/commands/conversation/mute.js +30 -0
- package/dist/commands/conversation/mute.js.map +1 -0
- package/dist/commands/conversation/reply.d.ts +3 -0
- package/dist/commands/conversation/reply.d.ts.map +1 -0
- package/dist/commands/conversation/reply.js +37 -0
- package/dist/commands/conversation/reply.js.map +1 -0
- package/dist/commands/conversation/unmute.d.ts +3 -0
- package/dist/commands/conversation/unmute.d.ts.map +1 -0
- package/dist/commands/conversation/unmute.js +28 -0
- package/dist/commands/conversation/unmute.js.map +1 -0
- package/dist/commands/conversation/unread.d.ts +3 -0
- package/dist/commands/conversation/unread.d.ts.map +1 -0
- package/dist/commands/conversation/unread.js +56 -0
- package/dist/commands/conversation/unread.js.map +1 -0
- package/dist/commands/conversation/view.d.ts +3 -0
- package/dist/commands/conversation/view.d.ts.map +1 -0
- package/dist/commands/conversation/view.js +77 -0
- package/dist/commands/conversation/view.js.map +1 -0
- package/dist/commands/conversation/with.d.ts +3 -0
- package/dist/commands/conversation/with.d.ts.map +1 -0
- package/dist/commands/conversation/with.js +48 -0
- package/dist/commands/conversation/with.js.map +1 -0
- package/dist/commands/doctor.d.ts +9 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +325 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/groups/create.d.ts +8 -0
- package/dist/commands/groups/create.d.ts.map +1 -0
- package/dist/commands/groups/create.js +27 -0
- package/dist/commands/groups/create.js.map +1 -0
- package/dist/commands/groups/delete.d.ts +7 -0
- package/dist/commands/groups/delete.d.ts.map +1 -0
- package/dist/commands/groups/delete.js +30 -0
- package/dist/commands/groups/delete.js.map +1 -0
- package/dist/commands/groups/index.d.ts +3 -0
- package/dist/commands/groups/index.d.ts.map +1 -0
- package/dist/commands/groups/index.js +98 -0
- package/dist/commands/groups/index.js.map +1 -0
- package/dist/commands/groups/list.d.ts +7 -0
- package/dist/commands/groups/list.d.ts.map +1 -0
- package/dist/commands/groups/list.js +42 -0
- package/dist/commands/groups/list.js.map +1 -0
- package/dist/commands/groups/members.d.ts +4 -0
- package/dist/commands/groups/members.d.ts.map +1 -0
- package/dist/commands/groups/members.js +90 -0
- package/dist/commands/groups/members.js.map +1 -0
- package/dist/commands/groups/rename.d.ts +3 -0
- package/dist/commands/groups/rename.d.ts.map +1 -0
- package/dist/commands/groups/rename.js +28 -0
- package/dist/commands/groups/rename.js.map +1 -0
- package/dist/commands/groups/view.d.ts +7 -0
- package/dist/commands/groups/view.d.ts.map +1 -0
- package/dist/commands/groups/view.js +52 -0
- package/dist/commands/groups/view.js.map +1 -0
- package/dist/commands/inbox.d.ts +3 -0
- package/dist/commands/inbox.d.ts.map +1 -0
- package/dist/commands/inbox.js +147 -0
- package/dist/commands/inbox.js.map +1 -0
- package/dist/commands/mentions.d.ts +3 -0
- package/dist/commands/mentions.d.ts.map +1 -0
- package/dist/commands/mentions.js +23 -0
- package/dist/commands/mentions.js.map +1 -0
- package/dist/commands/msg/delete.d.ts +5 -0
- package/dist/commands/msg/delete.d.ts.map +1 -0
- package/dist/commands/msg/delete.js +31 -0
- package/dist/commands/msg/delete.js.map +1 -0
- package/dist/commands/msg/index.d.ts +3 -0
- package/dist/commands/msg/index.d.ts.map +1 -0
- package/dist/commands/msg/index.js +47 -0
- package/dist/commands/msg/index.js.map +1 -0
- package/dist/commands/msg/update.d.ts +5 -0
- package/dist/commands/msg/update.d.ts.map +1 -0
- package/dist/commands/msg/update.js +37 -0
- package/dist/commands/msg/update.js.map +1 -0
- package/dist/commands/msg/view.d.ts +3 -0
- package/dist/commands/msg/view.d.ts.map +1 -0
- package/dist/commands/msg/view.js +31 -0
- package/dist/commands/msg/view.js.map +1 -0
- package/dist/commands/react.d.ts +3 -0
- package/dist/commands/react.d.ts.map +1 -0
- package/dist/commands/react.js +149 -0
- package/dist/commands/react.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +30 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/skill/index.d.ts +3 -0
- package/dist/commands/skill/index.d.ts.map +1 -0
- package/dist/commands/skill/index.js +29 -0
- package/dist/commands/skill/index.js.map +1 -0
- package/dist/commands/skill/install.d.ts +3 -0
- package/dist/commands/skill/install.d.ts.map +1 -0
- package/dist/commands/skill/install.js +16 -0
- package/dist/commands/skill/install.js.map +1 -0
- package/dist/commands/skill/list.d.ts +6 -0
- package/dist/commands/skill/list.d.ts.map +1 -0
- package/dist/commands/skill/list.js +22 -0
- package/dist/commands/skill/list.js.map +1 -0
- package/dist/commands/skill/uninstall.d.ts +3 -0
- package/dist/commands/skill/uninstall.d.ts.map +1 -0
- package/dist/commands/skill/uninstall.js +15 -0
- package/dist/commands/skill/uninstall.js.map +1 -0
- package/dist/commands/skill/update.d.ts +3 -0
- package/dist/commands/skill/update.d.ts.map +1 -0
- package/dist/commands/skill/update.js +37 -0
- package/dist/commands/skill/update.js.map +1 -0
- package/dist/commands/thread/create.d.ts +8 -0
- package/dist/commands/thread/create.d.ts.map +1 -0
- package/dist/commands/thread/create.js +70 -0
- package/dist/commands/thread/create.js.map +1 -0
- package/dist/commands/thread/delete.d.ts +7 -0
- package/dist/commands/thread/delete.d.ts.map +1 -0
- package/dist/commands/thread/delete.js +38 -0
- package/dist/commands/thread/delete.js.map +1 -0
- package/dist/commands/thread/helpers.d.ts +24 -0
- package/dist/commands/thread/helpers.d.ts.map +1 -0
- package/dist/commands/thread/helpers.js +45 -0
- package/dist/commands/thread/helpers.js.map +1 -0
- package/dist/commands/thread/index.d.ts +3 -0
- package/dist/commands/thread/index.d.ts.map +1 -0
- package/dist/commands/thread/index.js +134 -0
- package/dist/commands/thread/index.js.map +1 -0
- package/dist/commands/thread/mutate.d.ts +5 -0
- package/dist/commands/thread/mutate.d.ts.map +1 -0
- package/dist/commands/thread/mutate.js +23 -0
- package/dist/commands/thread/mutate.js.map +1 -0
- package/dist/commands/thread/mute.d.ts +8 -0
- package/dist/commands/thread/mute.d.ts.map +1 -0
- package/dist/commands/thread/mute.js +63 -0
- package/dist/commands/thread/mute.js.map +1 -0
- package/dist/commands/thread/rename.d.ts +3 -0
- package/dist/commands/thread/rename.d.ts.map +1 -0
- package/dist/commands/thread/rename.js +29 -0
- package/dist/commands/thread/rename.js.map +1 -0
- package/dist/commands/thread/reply.d.ts +9 -0
- package/dist/commands/thread/reply.d.ts.map +1 -0
- package/dist/commands/thread/reply.js +85 -0
- package/dist/commands/thread/reply.js.map +1 -0
- package/dist/commands/thread/update.d.ts +5 -0
- package/dist/commands/thread/update.d.ts.map +1 -0
- package/dist/commands/thread/update.js +45 -0
- package/dist/commands/thread/update.js.map +1 -0
- package/dist/commands/thread/view.d.ts +9 -0
- package/dist/commands/thread/view.d.ts.map +1 -0
- package/dist/commands/thread/view.js +171 -0
- package/dist/commands/thread/view.js.map +1 -0
- package/dist/commands/update/index.d.ts +3 -0
- package/dist/commands/update/index.d.ts.map +1 -0
- package/dist/commands/update/index.js +14 -0
- package/dist/commands/update/index.js.map +1 -0
- package/dist/commands/user.d.ts +3 -0
- package/dist/commands/user.d.ts.map +1 -0
- package/dist/commands/user.js +90 -0
- package/dist/commands/user.js.map +1 -0
- package/dist/commands/view.d.ts +3 -0
- package/dist/commands/view.d.ts.map +1 -0
- package/dist/commands/view.js +68 -0
- package/dist/commands/view.js.map +1 -0
- package/dist/commands/workspace.d.ts +3 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +56 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +190 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +35 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +306 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/auth-constants.d.ts +3 -0
- package/dist/lib/auth-constants.d.ts.map +1 -0
- package/dist/lib/auth-constants.js +3 -0
- package/dist/lib/auth-constants.js.map +1 -0
- package/dist/lib/auth-pages.d.ts +3 -0
- package/dist/lib/auth-pages.d.ts.map +1 -0
- package/dist/lib/auth-pages.js +707 -0
- package/dist/lib/auth-pages.js.map +1 -0
- package/dist/lib/auth-provider.d.ts +74 -0
- package/dist/lib/auth-provider.d.ts.map +1 -0
- package/dist/lib/auth-provider.js +238 -0
- package/dist/lib/auth-provider.js.map +1 -0
- package/dist/lib/auth.d.ts +39 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +57 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/comms-account.d.ts +22 -0
- package/dist/lib/comms-account.d.ts.map +1 -0
- package/dist/lib/comms-account.js +23 -0
- package/dist/lib/comms-account.js.map +1 -0
- package/dist/lib/completion.d.ts +31 -0
- package/dist/lib/completion.d.ts.map +1 -0
- package/dist/lib/completion.js +173 -0
- package/dist/lib/completion.js.map +1 -0
- package/dist/lib/config.d.ts +61 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +184 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/dates.d.ts +3 -0
- package/dist/lib/dates.d.ts.map +1 -0
- package/dist/lib/dates.js +44 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/errors.d.ts +28 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +34 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/global-args.d.ts +52 -0
- package/dist/lib/global-args.d.ts.map +1 -0
- package/dist/lib/global-args.js +124 -0
- package/dist/lib/global-args.js.map +1 -0
- package/dist/lib/input.d.ts +3 -0
- package/dist/lib/input.d.ts.map +1 -0
- package/dist/lib/input.js +80 -0
- package/dist/lib/input.js.map +1 -0
- package/dist/lib/markdown.d.ts +3 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/markdown.js +15 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/options.d.ts +16 -0
- package/dist/lib/options.d.ts.map +1 -0
- package/dist/lib/options.js +2 -0
- package/dist/lib/options.js.map +1 -0
- package/dist/lib/output.d.ts +41 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +184 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/permissions.d.ts +4 -0
- package/dist/lib/permissions.d.ts.map +1 -0
- package/dist/lib/permissions.js +41 -0
- package/dist/lib/permissions.js.map +1 -0
- package/dist/lib/progress.d.ts +29 -0
- package/dist/lib/progress.d.ts.map +1 -0
- package/dist/lib/progress.js +86 -0
- package/dist/lib/progress.js.map +1 -0
- package/dist/lib/public-channels.d.ts +4 -0
- package/dist/lib/public-channels.d.ts.map +1 -0
- package/dist/lib/public-channels.js +32 -0
- package/dist/lib/public-channels.js.map +1 -0
- package/dist/lib/refs.d.ts +62 -0
- package/dist/lib/refs.d.ts.map +1 -0
- package/dist/lib/refs.js +378 -0
- package/dist/lib/refs.js.map +1 -0
- package/dist/lib/search-api.d.ts +25 -0
- package/dist/lib/search-api.d.ts.map +1 -0
- package/dist/lib/search-api.js +93 -0
- package/dist/lib/search-api.js.map +1 -0
- package/dist/lib/search-helpers.d.ts +32 -0
- package/dist/lib/search-helpers.d.ts.map +1 -0
- package/dist/lib/search-helpers.js +183 -0
- package/dist/lib/search-helpers.js.map +1 -0
- package/dist/lib/skills/content.d.ts +8 -0
- package/dist/lib/skills/content.d.ts.map +1 -0
- package/dist/lib/skills/content.js +410 -0
- package/dist/lib/skills/content.js.map +1 -0
- package/dist/lib/skills/create-installer.d.ts +9 -0
- package/dist/lib/skills/create-installer.d.ts.map +1 -0
- package/dist/lib/skills/create-installer.js +65 -0
- package/dist/lib/skills/create-installer.js.map +1 -0
- package/dist/lib/skills/index.d.ts +7 -0
- package/dist/lib/skills/index.d.ts.map +1 -0
- package/dist/lib/skills/index.js +54 -0
- package/dist/lib/skills/index.js.map +1 -0
- package/dist/lib/skills/types.d.ts +30 -0
- package/dist/lib/skills/types.d.ts.map +1 -0
- package/dist/lib/skills/types.js +2 -0
- package/dist/lib/skills/types.js.map +1 -0
- package/dist/lib/skills/update-installed.d.ts +9 -0
- package/dist/lib/skills/update-installed.d.ts.map +1 -0
- package/dist/lib/skills/update-installed.js +20 -0
- package/dist/lib/skills/update-installed.js.map +1 -0
- package/dist/lib/spinner.d.ts +3 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/dist/lib/spinner.js +10 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/threads.d.ts +4 -0
- package/dist/lib/threads.d.ts.map +1 -0
- package/dist/lib/threads.js +6 -0
- package/dist/lib/threads.js.map +1 -0
- package/dist/lib/update.d.ts +13 -0
- package/dist/lib/update.d.ts.map +1 -0
- package/dist/lib/update.js +23 -0
- package/dist/lib/update.js.map +1 -0
- package/dist/lib/user-records.d.ts +15 -0
- package/dist/lib/user-records.d.ts.map +1 -0
- package/dist/lib/user-records.js +84 -0
- package/dist/lib/user-records.js.map +1 -0
- package/dist/lib/validation.d.ts +2 -0
- package/dist/lib/validation.d.ts.map +1 -0
- package/dist/lib/validation.js +7 -0
- package/dist/lib/validation.js.map +1 -0
- package/dist/postinstall.d.ts +2 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +4 -0
- package/dist/postinstall.js.map +1 -0
- package/package.json +77 -8
- package/scripts/check-skill-sync.js +40 -0
- package/scripts/postinstall.js +12 -0
- package/scripts/sync-skill.js +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-pages.js","sourceRoot":"","sources":["../../src/lib/auth-pages.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa;IACzB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAicH,CAAA;AACR,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,YAAoB;IAC5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAuPE,YAAY;;;;QAIjB,CAAA;AACR,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type AccountRef, type AuthAccount, type AuthProvider, type KeyringTokenStore } from '@doist/cli-core/auth';
|
|
2
|
+
import { type AuthMode } from './config.js';
|
|
3
|
+
export declare const AUTHORIZATION_URL = "https://comms.todoist.com/oauth/authorize";
|
|
4
|
+
export declare const TOKEN_URL = "https://comms.todoist.com/oauth/access_token";
|
|
5
|
+
export declare const REGISTRATION_URL = "https://comms.todoist.com/oauth/register";
|
|
6
|
+
export declare const READ_WRITE_SCOPES: string[];
|
|
7
|
+
export declare const READ_ONLY_SCOPES: string[];
|
|
8
|
+
/**
|
|
9
|
+
* The scope set a login is granted, as a pure function of `--read-only`. Single
|
|
10
|
+
* source of truth shared by `attachCommsLoginCommand`'s `resolveScopes` (what we
|
|
11
|
+
* request at authorize) and the provider's `validate` (what we record on the
|
|
12
|
+
* account), so the two can't drift.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getScopes(readOnly: boolean): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Narrow account shape: only fields that round-trip through the local token
|
|
17
|
+
* store. `id` is the stringified numeric Comms user id (so cli-core's
|
|
18
|
+
* `AuthAccount.id` string contract holds), `label` is the user's display
|
|
19
|
+
* name. Richer session-user details are fetched on demand via the API
|
|
20
|
+
* rather than threaded through the auth flow.
|
|
21
|
+
*/
|
|
22
|
+
export type CommsAccount = AuthAccount & {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
authMode: AuthMode;
|
|
26
|
+
authScope: string;
|
|
27
|
+
};
|
|
28
|
+
export type CommsTokenStore = KeyringTokenStore<CommsAccount>;
|
|
29
|
+
/**
|
|
30
|
+
* Sentinel for the `{ id: '', label: '' }` snapshot that `tdc auth token`
|
|
31
|
+
* persists when the user passes a raw token with no identity attached. The
|
|
32
|
+
* empty-id/empty-label pair is the contract between `loginWithToken` (writer)
|
|
33
|
+
* and `account current` / `account list` (readers); centralise it here so
|
|
34
|
+
* each call site agrees on the shape.
|
|
35
|
+
*/
|
|
36
|
+
export declare const MANUAL_TOKEN_ACCOUNT: CommsAccount;
|
|
37
|
+
/** True when `account` is the identity-less snapshot produced by `tdc auth token`. */
|
|
38
|
+
export declare function isManualTokenAccount(account: Pick<CommsAccount, 'id' | 'label'>): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Comms's OAuth flow uses RFC 7591 Dynamic Client Registration: each login
|
|
41
|
+
* mints a fresh `client_id` / `client_secret`, then runs the standard PKCE
|
|
42
|
+
* authorize + token exchange. cli-core's `createDcrProvider` drives all of that
|
|
43
|
+
* via `oauth4webapi`; the only comms-specific piece is `validate`, which probes
|
|
44
|
+
* `getSessionUser` and records the auth mode/scope the login was granted.
|
|
45
|
+
*
|
|
46
|
+
* `authMode` / `authScope` are derived from `handshake.readOnly` (folded in by
|
|
47
|
+
* `runOAuthFlow`) rather than threaded through `authorize`, because the scope
|
|
48
|
+
* set is itself a pure function of `readOnly` (see `resolveScopes` in login.ts).
|
|
49
|
+
*/
|
|
50
|
+
export declare function createCommsAuthProvider(): AuthProvider<CommsAccount>;
|
|
51
|
+
/**
|
|
52
|
+
* Accepts `42`, `id:42`, and case-insensitive labels — `parseRef` normalises
|
|
53
|
+
* the numeric forms. Broader than cli-core's default strict-equality matcher.
|
|
54
|
+
*/
|
|
55
|
+
export declare function matchCommsAccount(account: CommsAccount, ref: AccountRef): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Resolve a `ref` against the local store, returning the canonical account.
|
|
58
|
+
* Throws `ACCOUNT_NOT_FOUND` on a miss. Shared between the `tdc account ...`
|
|
59
|
+
* commands and `withUserRefAware` so the same hint reaches every caller.
|
|
60
|
+
*/
|
|
61
|
+
export declare function findAccountInStore(store: CommsTokenStore, ref: AccountRef): Promise<CommsAccount>;
|
|
62
|
+
/**
|
|
63
|
+
* `COMMS_API_TOKEN` short-circuits `active()` only when no explicit ref is
|
|
64
|
+
* supplied — cli-core's `KeyringTokenStore` doesn't know about the env var,
|
|
65
|
+
* and an explicit ref means the caller targets a specific stored account.
|
|
66
|
+
*/
|
|
67
|
+
export declare function createCommsTokenStore(): CommsTokenStore;
|
|
68
|
+
/**
|
|
69
|
+
* Where the currently-active token lives. Returns `'config-file'` whenever
|
|
70
|
+
* a plaintext token is on disk so doctor/config-view reports the
|
|
71
|
+
* security-relevant state accurately.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getActiveTokenSource(): Promise<'env' | 'secure-store' | 'config-file'>;
|
|
74
|
+
//# sourceMappingURL=auth-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-provider.d.ts","sourceRoot":"","sources":["../../src/lib/auth-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EAGjB,KAAK,iBAAiB,EACzB,MAAM,sBAA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G,aAAa,CAAC,CAM5F"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { createDcrProvider, createKeyringTokenStore, } from '@doist/cli-core/auth';
|
|
2
|
+
import { createWrappedCommsClient } from './api.js';
|
|
3
|
+
import { SECURE_STORE_SERVICE } from './auth-constants.js';
|
|
4
|
+
import { toCommsAccount } from './comms-account.js';
|
|
5
|
+
import { getConfig, getConfigPath } from './config.js';
|
|
6
|
+
import { CliError } from './errors.js';
|
|
7
|
+
import { parseRef } from './refs.js';
|
|
8
|
+
import { createCommsUserRecordStore, getDefaultUserRecord } from './user-records.js';
|
|
9
|
+
export const AUTHORIZATION_URL = 'https://comms.todoist.com/oauth/authorize';
|
|
10
|
+
export const TOKEN_URL = 'https://comms.todoist.com/oauth/access_token';
|
|
11
|
+
export const REGISTRATION_URL = 'https://comms.todoist.com/oauth/register';
|
|
12
|
+
const LOGO_URI = 'https://raw.githubusercontent.com/Doist/comms-cli/d65c447ff453eb36af585044c2f5f2f602bcdb34/icons/comms-cli.png';
|
|
13
|
+
export const READ_WRITE_SCOPES = [
|
|
14
|
+
'user:read',
|
|
15
|
+
'user:write',
|
|
16
|
+
'workspaces:read',
|
|
17
|
+
'channels:read',
|
|
18
|
+
'threads:read',
|
|
19
|
+
'threads:write',
|
|
20
|
+
'comments:read',
|
|
21
|
+
'comments:write',
|
|
22
|
+
'messages:read',
|
|
23
|
+
'messages:write',
|
|
24
|
+
'reactions:read',
|
|
25
|
+
'reactions:write',
|
|
26
|
+
'groups:read',
|
|
27
|
+
'groups:write',
|
|
28
|
+
'groups:remove',
|
|
29
|
+
'search:read',
|
|
30
|
+
'notifications:read',
|
|
31
|
+
];
|
|
32
|
+
export const READ_ONLY_SCOPES = [
|
|
33
|
+
'user:read',
|
|
34
|
+
'workspaces:read',
|
|
35
|
+
'channels:read',
|
|
36
|
+
'threads:read',
|
|
37
|
+
'comments:read',
|
|
38
|
+
'messages:read',
|
|
39
|
+
'reactions:read',
|
|
40
|
+
'groups:read',
|
|
41
|
+
'search:read',
|
|
42
|
+
'notifications:read',
|
|
43
|
+
];
|
|
44
|
+
const AUTH_HINTS = ['Try again: tdc auth login', 'Or set COMMS_API_TOKEN environment variable'];
|
|
45
|
+
/**
|
|
46
|
+
* The scope set a login is granted, as a pure function of `--read-only`. Single
|
|
47
|
+
* source of truth shared by `attachCommsLoginCommand`'s `resolveScopes` (what we
|
|
48
|
+
* request at authorize) and the provider's `validate` (what we record on the
|
|
49
|
+
* account), so the two can't drift.
|
|
50
|
+
*/
|
|
51
|
+
export function getScopes(readOnly) {
|
|
52
|
+
return readOnly ? READ_ONLY_SCOPES : READ_WRITE_SCOPES;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Sentinel for the `{ id: '', label: '' }` snapshot that `tdc auth token`
|
|
56
|
+
* persists when the user passes a raw token with no identity attached. The
|
|
57
|
+
* empty-id/empty-label pair is the contract between `loginWithToken` (writer)
|
|
58
|
+
* and `account current` / `account list` (readers); centralise it here so
|
|
59
|
+
* each call site agrees on the shape.
|
|
60
|
+
*/
|
|
61
|
+
export const MANUAL_TOKEN_ACCOUNT = {
|
|
62
|
+
id: '',
|
|
63
|
+
label: '',
|
|
64
|
+
authMode: 'unknown',
|
|
65
|
+
authScope: '',
|
|
66
|
+
};
|
|
67
|
+
/** True when `account` is the identity-less snapshot produced by `tdc auth token`. */
|
|
68
|
+
export function isManualTokenAccount(account) {
|
|
69
|
+
return !account.id || !account.label;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Comms's OAuth flow uses RFC 7591 Dynamic Client Registration: each login
|
|
73
|
+
* mints a fresh `client_id` / `client_secret`, then runs the standard PKCE
|
|
74
|
+
* authorize + token exchange. cli-core's `createDcrProvider` drives all of that
|
|
75
|
+
* via `oauth4webapi`; the only comms-specific piece is `validate`, which probes
|
|
76
|
+
* `getSessionUser` and records the auth mode/scope the login was granted.
|
|
77
|
+
*
|
|
78
|
+
* `authMode` / `authScope` are derived from `handshake.readOnly` (folded in by
|
|
79
|
+
* `runOAuthFlow`) rather than threaded through `authorize`, because the scope
|
|
80
|
+
* set is itself a pure function of `readOnly` (see `resolveScopes` in login.ts).
|
|
81
|
+
*/
|
|
82
|
+
export function createCommsAuthProvider() {
|
|
83
|
+
return createDcrProvider({
|
|
84
|
+
registrationUrl: REGISTRATION_URL,
|
|
85
|
+
authorizeUrl: AUTHORIZATION_URL,
|
|
86
|
+
tokenUrl: TOKEN_URL,
|
|
87
|
+
clientMetadata: {
|
|
88
|
+
clientName: 'Comms CLI',
|
|
89
|
+
clientUri: 'https://github.com/doist/comms-cli',
|
|
90
|
+
logoUri: LOGO_URI,
|
|
91
|
+
applicationType: 'native',
|
|
92
|
+
// Comms client_ids can contain `_`. oauth4webapi's
|
|
93
|
+
// `client_secret_basic` form-url-encodes the Basic credential per
|
|
94
|
+
// RFC 6749 §2.3.1 (`_` → `%5F`), and the token endpoint doesn't
|
|
95
|
+
// url-decode it, so the lookup fails with "client_id not found".
|
|
96
|
+
// `client_secret_post` sends the credential in the body via
|
|
97
|
+
// URLSearchParams, which preserves `_`, sidestepping the mismatch.
|
|
98
|
+
tokenEndpointAuthMethod: 'client_secret_post',
|
|
99
|
+
},
|
|
100
|
+
errorHints: AUTH_HINTS,
|
|
101
|
+
async validate({ token, handshake }) {
|
|
102
|
+
// `runOAuthFlow` folds a boolean `readOnly` into the handshake.
|
|
103
|
+
// Fail closed on a missing/malformed value rather than letting
|
|
104
|
+
// `Boolean(undefined)` silently grant read-write (which would relax
|
|
105
|
+
// the local write guard).
|
|
106
|
+
const readOnly = handshake.readOnly;
|
|
107
|
+
if (typeof readOnly !== 'boolean') {
|
|
108
|
+
throw new CliError('AUTH_FAILED', 'Internal: auth handshake missing the readOnly flag.', AUTH_HINTS);
|
|
109
|
+
}
|
|
110
|
+
const client = createWrappedCommsClient(token);
|
|
111
|
+
const user = await client.users.getSessionUser();
|
|
112
|
+
return toCommsAccount(user, {
|
|
113
|
+
authMode: readOnly ? 'read-only' : 'read-write',
|
|
114
|
+
authScope: getScopes(readOnly).join(' '),
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Accepts `42`, `id:42`, and case-insensitive labels — `parseRef` normalises
|
|
121
|
+
* the numeric forms. Broader than cli-core's default strict-equality matcher.
|
|
122
|
+
*/
|
|
123
|
+
export function matchCommsAccount(account, ref) {
|
|
124
|
+
// Identity-less manual-token snapshots (empty id + label) are never a valid
|
|
125
|
+
// ref target — they're hidden from `account list` and can't be `use`d /
|
|
126
|
+
// `remove`d. Guard here so an empty-ish ref (`""`, `id:`) can't resolve to
|
|
127
|
+
// one through the keyring store's ref matching.
|
|
128
|
+
if (isManualTokenAccount(account))
|
|
129
|
+
return false;
|
|
130
|
+
const parsed = parseRef(ref);
|
|
131
|
+
if (parsed.type === 'id')
|
|
132
|
+
return account.id === parsed.id;
|
|
133
|
+
if (parsed.type === 'name')
|
|
134
|
+
return account.label.toLowerCase() === parsed.name.toLowerCase();
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const TOKEN_ENV_VAR = 'COMMS_API_TOKEN';
|
|
138
|
+
/**
|
|
139
|
+
* The `COMMS_API_TOKEN` env override that takes precedence over the keyring
|
|
140
|
+
* store, or `null` to defer to it. Only applies when no explicit ref is
|
|
141
|
+
* supplied — an explicit ref means the caller targets a specific stored
|
|
142
|
+
* account. Shared by the store's `active()` and `activeBundle()` so the two
|
|
143
|
+
* reads can't diverge.
|
|
144
|
+
*/
|
|
145
|
+
function resolveEnvOverride(ref) {
|
|
146
|
+
if (ref === undefined) {
|
|
147
|
+
const envToken = process.env[TOKEN_ENV_VAR];
|
|
148
|
+
if (envToken)
|
|
149
|
+
return { token: envToken, account: MANUAL_TOKEN_ACCOUNT };
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Resolve a `ref` against the local store, returning the canonical account.
|
|
155
|
+
* Throws `ACCOUNT_NOT_FOUND` on a miss. Shared between the `tdc account ...`
|
|
156
|
+
* commands and `withUserRefAware` so the same hint reaches every caller.
|
|
157
|
+
*/
|
|
158
|
+
export async function findAccountInStore(store, ref) {
|
|
159
|
+
const records = await store.list();
|
|
160
|
+
// Manual-token snapshots have no id/label and can't be the target of a
|
|
161
|
+
// ref-based command. Excluding them here keeps `tdc account use|remove`
|
|
162
|
+
// honest with what `tdc account list` shows.
|
|
163
|
+
const match = records
|
|
164
|
+
.filter(({ account }) => !isManualTokenAccount(account))
|
|
165
|
+
.find(({ account }) => matchCommsAccount(account, ref));
|
|
166
|
+
if (!match) {
|
|
167
|
+
throw new CliError('ACCOUNT_NOT_FOUND', `No stored account matches "${ref}".`, [
|
|
168
|
+
'Run: tdc account list',
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
return match.account;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* `COMMS_API_TOKEN` short-circuits `active()` only when no explicit ref is
|
|
175
|
+
* supplied — cli-core's `KeyringTokenStore` doesn't know about the env var,
|
|
176
|
+
* and an explicit ref means the caller targets a specific stored account.
|
|
177
|
+
*/
|
|
178
|
+
export function createCommsTokenStore() {
|
|
179
|
+
const inner = createKeyringTokenStore({
|
|
180
|
+
serviceName: SECURE_STORE_SERVICE,
|
|
181
|
+
userRecords: createCommsUserRecordStore(),
|
|
182
|
+
recordsLocation: getConfigPath(),
|
|
183
|
+
matchAccount: matchCommsAccount,
|
|
184
|
+
});
|
|
185
|
+
return Object.assign(Object.create(inner), {
|
|
186
|
+
async active(ref) {
|
|
187
|
+
return resolveEnvOverride(ref) ?? inner.active(ref);
|
|
188
|
+
},
|
|
189
|
+
// Mirror `active()`: cli-core's auth commands read the live credential
|
|
190
|
+
// through `activeBundle()` (it carries the refresh slot too), so the
|
|
191
|
+
// env-token fallback must apply here as well or `tdc auth status` would
|
|
192
|
+
// report no token for env-token sessions.
|
|
193
|
+
async activeBundle(ref) {
|
|
194
|
+
const override = resolveEnvOverride(ref);
|
|
195
|
+
if (override) {
|
|
196
|
+
return { account: override.account, bundle: { accessToken: override.token } };
|
|
197
|
+
}
|
|
198
|
+
return inner.activeBundle(ref);
|
|
199
|
+
},
|
|
200
|
+
// cli-core's `account current` resolves through `activeAccount()`. An
|
|
201
|
+
// env-token session isn't a v2 store account, so report `null` — the
|
|
202
|
+
// attacher then routes to its `onNotAuthenticated` hook, which renders
|
|
203
|
+
// the env notice. (A manual-token snapshot stays a real store account;
|
|
204
|
+
// `account current` special-cases it in its renderers.)
|
|
205
|
+
async activeAccount(ref) {
|
|
206
|
+
if (resolveEnvOverride(ref))
|
|
207
|
+
return null;
|
|
208
|
+
return inner.activeAccount(ref);
|
|
209
|
+
},
|
|
210
|
+
async set(account, token) {
|
|
211
|
+
return inner.set(account, token);
|
|
212
|
+
},
|
|
213
|
+
async clear(ref) {
|
|
214
|
+
return inner.clear(ref);
|
|
215
|
+
},
|
|
216
|
+
async list() {
|
|
217
|
+
return inner.list();
|
|
218
|
+
},
|
|
219
|
+
async setDefault(ref) {
|
|
220
|
+
return inner.setDefault(ref);
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Where the currently-active token lives. Returns `'config-file'` whenever
|
|
226
|
+
* a plaintext token is on disk so doctor/config-view reports the
|
|
227
|
+
* security-relevant state accurately.
|
|
228
|
+
*/
|
|
229
|
+
export async function getActiveTokenSource() {
|
|
230
|
+
if (process.env[TOKEN_ENV_VAR])
|
|
231
|
+
return 'env';
|
|
232
|
+
const config = await getConfig();
|
|
233
|
+
const record = getDefaultUserRecord(config);
|
|
234
|
+
if (record?.fallbackToken)
|
|
235
|
+
return 'config-file';
|
|
236
|
+
return 'secure-store';
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=auth-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-provider.js","sourceRoot":"","sources":["../../src/lib/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,EAAE,CAAA;YACjF,CAAC;YACD,OAAO,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QAClC,CAAC;QACD,sEAAsE;QACtE,qEAAqE;QACrE,uEAAuE;QACvE,uEAAuE;QACvE,wDAAwD;QACxD,KAAK,CAAC,aAAa,CAAC,GAAgB;YAChC,IAAI,kBAAkB,CAAC,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAA;YACxC,OAAO,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;QACnC,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,OAAqB,EAAE,KAAa;YAC1C,OAAO,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACpC,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,GAAgB;YACxB,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC3B,CAAC;QACD,KAAK,CAAC,IAAI;YACN,OAAO,KAAK,CAAC,IAAI,EAAE,CAAA;QACvB,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,GAAe;YAC5B,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QAChC,CAAC;KACJ,CAAC,CAAA;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACtC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAAE,OAAO,KAAK,CAAA;IAC5C,MAAM,MAAM,GAAG,MAAM,SAAS,EAAE,CAAA;IAChC,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAC3C,IAAI,MAAM,EAAE,aAAa;QAAE,OAAO,aAAa,CAAA;IAC/C,OAAO,cAAc,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { SecureStoreUnavailableError } from '@doist/cli-core/auth';
|
|
2
|
+
import { type AuthMode } from './config.js';
|
|
3
|
+
import { CliError } from './errors.js';
|
|
4
|
+
export { SecureStoreUnavailableError };
|
|
5
|
+
export declare const TOKEN_ENV_VAR = "COMMS_API_TOKEN";
|
|
6
|
+
export declare const SECURE_STORE_DESCRIPTION = "system credential manager";
|
|
7
|
+
export type TokenStorageLocation = 'secure-store' | 'config-file';
|
|
8
|
+
export type TokenStorageResult = {
|
|
9
|
+
storage: TokenStorageLocation;
|
|
10
|
+
warning?: string;
|
|
11
|
+
};
|
|
12
|
+
export type AuthMetadata = {
|
|
13
|
+
authMode: AuthMode;
|
|
14
|
+
authScope?: string;
|
|
15
|
+
authUserId?: number;
|
|
16
|
+
authUserName?: string;
|
|
17
|
+
source: 'env' | 'config';
|
|
18
|
+
};
|
|
19
|
+
export type AuthProbeMetadata = {
|
|
20
|
+
authMode: AuthMode;
|
|
21
|
+
authScope?: string;
|
|
22
|
+
authUserId?: number;
|
|
23
|
+
authUserName?: string;
|
|
24
|
+
source: 'env' | 'config-file' | 'secure-store';
|
|
25
|
+
};
|
|
26
|
+
export type AuthProbeResult = {
|
|
27
|
+
token: string;
|
|
28
|
+
metadata: AuthProbeMetadata;
|
|
29
|
+
};
|
|
30
|
+
export declare class NoTokenError extends CliError {
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
/** Read the active token. The store wraps env-var precedence internally. */
|
|
34
|
+
export declare function getApiToken(): Promise<string>;
|
|
35
|
+
/** Token + metadata in one round-trip for `tdc config view` / `tdc doctor`. */
|
|
36
|
+
export declare function probeApiToken(): Promise<AuthProbeResult>;
|
|
37
|
+
/** Auth metadata for `tdc auth status` and `ensureWriteAllowed`. */
|
|
38
|
+
export declare function getAuthMetadata(): Promise<AuthMetadata>;
|
|
39
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAGlE,OAAO,E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js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SecureStoreUnavailableError } from '@doist/cli-core/auth';
|
|
2
|
+
import { createCommsTokenStore, getActiveTokenSource } from './auth-provider.js';
|
|
3
|
+
import { getConfig } from './config.js';
|
|
4
|
+
import { CliError } from './errors.js';
|
|
5
|
+
import { getDefaultUserRecord } from './user-records.js';
|
|
6
|
+
export { SecureStoreUnavailableError };
|
|
7
|
+
export const TOKEN_ENV_VAR = 'COMMS_API_TOKEN';
|
|
8
|
+
export const SECURE_STORE_DESCRIPTION = 'system credential manager';
|
|
9
|
+
export class NoTokenError extends CliError {
|
|
10
|
+
constructor() {
|
|
11
|
+
super('NO_TOKEN', `No API token found. Set ${TOKEN_ENV_VAR} or run \`tdc auth login\` or \`tdc auth token <token>\`.`, ['Set COMMS_API_TOKEN or run: tdc auth login'], 'info');
|
|
12
|
+
this.name = 'NoTokenError';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Read the active token. The store wraps env-var precedence internally. */
|
|
16
|
+
export async function getApiToken() {
|
|
17
|
+
const snapshot = await createCommsTokenStore().active();
|
|
18
|
+
if (!snapshot)
|
|
19
|
+
throw new NoTokenError();
|
|
20
|
+
return snapshot.token;
|
|
21
|
+
}
|
|
22
|
+
/** Token + metadata in one round-trip for `tdc config view` / `tdc doctor`. */
|
|
23
|
+
export async function probeApiToken() {
|
|
24
|
+
const snapshot = await createCommsTokenStore().active();
|
|
25
|
+
if (!snapshot)
|
|
26
|
+
throw new NoTokenError();
|
|
27
|
+
const source = await getActiveTokenSource();
|
|
28
|
+
return {
|
|
29
|
+
token: snapshot.token,
|
|
30
|
+
metadata: source === 'env'
|
|
31
|
+
? { authMode: 'unknown', source: 'env' }
|
|
32
|
+
: { ...toAccountFields(snapshot.account), source },
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Auth metadata for `tdc auth status` and `ensureWriteAllowed`. */
|
|
36
|
+
export async function getAuthMetadata() {
|
|
37
|
+
if (process.env[TOKEN_ENV_VAR])
|
|
38
|
+
return { authMode: 'unknown', source: 'env' };
|
|
39
|
+
const config = await getConfig();
|
|
40
|
+
const record = getDefaultUserRecord(config);
|
|
41
|
+
if (record)
|
|
42
|
+
return { ...toAccountFields(record.account), source: 'config' };
|
|
43
|
+
return { authMode: 'unknown', source: 'config' };
|
|
44
|
+
}
|
|
45
|
+
function toAccountFields(account) {
|
|
46
|
+
return {
|
|
47
|
+
authMode: account.authMode,
|
|
48
|
+
authScope: account.authScope || undefined,
|
|
49
|
+
authUserId: account.id ? toAuthUserId(account.id) : undefined,
|
|
50
|
+
authUserName: account.label || undefined,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function toAuthUserId(id) {
|
|
54
|
+
const num = Number(id);
|
|
55
|
+
return Number.isFinite(num) && num > 0 ? num : undefined;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/lib/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAElE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAiB,SAAS,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAE,2BAA2B,EAAE,CAAA;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAA;AAE9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAA;AA8BnE,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACtC;QACI,KAAK,CACD,UAAU,EACV,2BAA2B,aAAa,2DAA2D,EACnG,CAAC,4CAA4C,CAAC,EAC9C,MAAM,CACT,CAAA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E,MAAM,EAAE,QAAQ,EAAE,CAAA;AACpD,CAAC;AAED,SAAS,eAAe,CAAC,OAAqB;IAM1C,OAAO;QACH,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,SAAS;QACzC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;QAC7D,YAAY,EAAE,OAAO,CAAC,KAAK,IAAI,SAAS;KAC3C,CAAA;AACL,CAAC;AAED,SAAS,YAAY,CAAC,EAAU;IAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;IACtB,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CommsAccount } from './auth-provider.js';
|
|
2
|
+
import type { AuthMode } from './config.js';
|
|
3
|
+
/** Canonical `CommsAccount` factory. Applies the `'unknown'` / `''` defaults. */
|
|
4
|
+
export declare function makeCommsAccount(input: {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
authMode?: AuthMode;
|
|
8
|
+
authScope?: string;
|
|
9
|
+
}): CommsAccount;
|
|
10
|
+
/**
|
|
11
|
+
* Adapt a Comms `getSessionUser` payload to a `CommsAccount`. Lives in its
|
|
12
|
+
* own module so `migrate-auth.ts` can import it without pulling in
|
|
13
|
+
* `auth-provider.ts`'s runtime graph.
|
|
14
|
+
*/
|
|
15
|
+
export declare function toCommsAccount(sessionUser: {
|
|
16
|
+
id: number;
|
|
17
|
+
fullName: string;
|
|
18
|
+
}, metadata?: {
|
|
19
|
+
authMode?: AuthMode;
|
|
20
|
+
authScope?: string;
|
|
21
|
+
}): CommsAccount;
|
|
22
|
+
//# sourceMappingURL=comms-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comms-account.d.ts","sourceRoot":"","sources":["../../src/lib/comms-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,YAAY,CAOf;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,WAAW,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAC7C,QAAQ,GAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAC3D,YAAY,CAOd"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Canonical `CommsAccount` factory. Applies the `'unknown'` / `''` defaults. */
|
|
2
|
+
export function makeCommsAccount(input) {
|
|
3
|
+
return {
|
|
4
|
+
id: input.id,
|
|
5
|
+
label: input.label,
|
|
6
|
+
authMode: input.authMode ?? 'unknown',
|
|
7
|
+
authScope: input.authScope ?? '',
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Adapt a Comms `getSessionUser` payload to a `CommsAccount`. Lives in its
|
|
12
|
+
* own module so `migrate-auth.ts` can import it without pulling in
|
|
13
|
+
* `auth-provider.ts`'s runtime graph.
|
|
14
|
+
*/
|
|
15
|
+
export function toCommsAccount(sessionUser, metadata = {}) {
|
|
16
|
+
return makeCommsAccount({
|
|
17
|
+
id: String(sessionUser.id),
|
|
18
|
+
label: sessionUser.fullName,
|
|
19
|
+
authMode: metadata.authMode,
|
|
20
|
+
authScope: metadata.authScope,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=comms-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comms-account.js","sourceRoot":"","sources":["../../src/lib/comms-account.ts"],"names":[],"mappings":"AAGA,iFAAiF;AACjF,MAAM,UAAU,gBAAgB,CAAC,KAKhC;IACG,OAAO;QACH,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,SAAS;QACrC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE;KACnC,CAAA;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC1B,WAA6C,EAC7C,WAAwD,EAAE;IAE1D,OAAO,gBAAgB,CAAC;QACpB,EAAE,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QAC1B,KAAK,EAAE,WAAW,CAAC,QAAQ;QAC3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,SAAS,EAAE,QAAQ,CAAC,SAAS;KAChC,CAAC,CAAA;AACN,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Command, Option } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Set argChoices on an option without enabling Commander's built-in
|
|
4
|
+
* validation. The choices are surfaced for shell completions but the
|
|
5
|
+
* option still accepts any value at parse time.
|
|
6
|
+
*/
|
|
7
|
+
export declare function withUnvalidatedChoices(opt: Option, values: string[]): Option;
|
|
8
|
+
export declare function withCaseInsensitiveChoices(opt: Option, values: string[]): Option;
|
|
9
|
+
/**
|
|
10
|
+
* Parse COMP_LINE into words, stripping the binary name and the
|
|
11
|
+
* 'completion-server' token that tabtab injects.
|
|
12
|
+
*
|
|
13
|
+
* FIXME: This splits on whitespace and does not handle quoted arguments.
|
|
14
|
+
* This is acceptable for command/flag traversal. It can be improved once
|
|
15
|
+
* tabtab exposes shell-provided tokenized words.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseCompLine(compLine: string): string[];
|
|
18
|
+
export interface CompletionItem {
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get completions for the current command line context.
|
|
24
|
+
*
|
|
25
|
+
* @param program - The root Commander program with all commands registered
|
|
26
|
+
* @param words - The words on the command line (excluding the binary name)
|
|
27
|
+
* @param current - The current word being typed (may be empty string)
|
|
28
|
+
* @returns Array of completion items
|
|
29
|
+
*/
|
|
30
|
+
export declare function getCompletions(program: Command, words: string[], current: string): CompletionItem[];
|
|
31
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/lib/completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEhD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAG5E;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAWhF;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAIxD;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACvB;AAoBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC1B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,MAAM,GAChB,cAAc,EAAE,CAsGlB"}
|