toolcraft 0.0.27 → 0.0.34
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/README.md +2 -2
- package/dist/cli.compile-check.js +7 -1
- package/dist/cli.d.ts +9 -1
- package/dist/cli.js +134 -62
- package/dist/design.d.ts +1 -0
- package/dist/design.js +1 -0
- package/dist/error-codes.d.ts +1 -0
- package/dist/error-codes.js +6 -0
- package/dist/human-in-loop/approvals-commands.js +2 -1
- package/dist/human-in-loop/runner.js +2 -2
- package/dist/index.d.ts +6 -2
- package/dist/json-schema-converter.js +12 -1
- package/dist/mcp-proxy.js +26 -9
- package/dist/mcp.js +55 -4
- package/dist/renderer.js +1 -1
- package/dist/schema-scope.js +22 -1
- package/dist/sdk.js +51 -3
- package/dist/source-snippet.js +1 -1
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +5 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +10 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +15 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.js +1 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +5 -0
- package/node_modules/@poe-code/agent-defs/dist/index.d.ts +2 -2
- package/node_modules/@poe-code/agent-defs/dist/index.js +1 -1
- package/node_modules/@poe-code/agent-defs/dist/registry.js +8 -1
- package/node_modules/@poe-code/agent-defs/dist/specifier.js +7 -3
- package/node_modules/@poe-code/agent-defs/dist/types.d.ts +5 -0
- package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript.js +7 -1
- package/node_modules/@poe-code/agent-mcp-config/dist/configs.js +6 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.d.ts +1 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.js +6 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +25 -15
- package/node_modules/@poe-code/config-mutations/dist/formats/json.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +1 -1
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.js +2 -4
- package/node_modules/@poe-code/config-mutations/dist/template/render.js +1 -1
- package/node_modules/@poe-code/config-mutations/package.json +1 -1
- package/node_modules/@poe-code/process-runner/dist/host/host-execution-env.js +18 -5
- package/node_modules/@poe-code/process-runner/dist/host/host-runner.js +38 -4
- package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +8 -2
- package/node_modules/@poe-code/task-list/dist/backends/gh-issues-sync.js +10 -7
- package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +13 -6
- package/node_modules/@poe-code/task-list/dist/backends/utils.js +15 -10
- package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +39 -22
- package/node_modules/@poe-code/task-list/dist/move.js +4 -1
- package/node_modules/@poe-code/task-list/dist/open.js +42 -20
- package/node_modules/@poe-code/task-list/dist/state-machine.js +8 -5
- package/node_modules/auth-store/dist/create-secret-store.js +6 -1
- package/node_modules/auth-store/dist/encrypted-file-store.d.ts +1 -1
- package/node_modules/auth-store/dist/encrypted-file-store.js +32 -28
- package/node_modules/auth-store/dist/error-codes.d.ts +1 -0
- package/node_modules/auth-store/dist/error-codes.js +5 -0
- package/node_modules/auth-store/dist/keychain-store.js +23 -8
- package/node_modules/mcp-oauth/dist/client/auth-store-session-store.js +17 -5
- package/node_modules/mcp-oauth/dist/client/authorization-state.js +21 -8
- package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +128 -55
- package/node_modules/mcp-oauth/dist/client/token-endpoint.js +27 -17
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +43 -22
- package/node_modules/toolcraft-design/README.md +148 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/components.d.ts +1 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/components.js +12 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/index.d.ts +1 -1
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/index.js +1 -1
- package/node_modules/toolcraft-design/dist/components/catalog.d.ts +26 -0
- package/node_modules/toolcraft-design/dist/components/catalog.js +94 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/index.d.ts +2 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/index.js +1 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/footer.js +1 -2
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/output-pane.js +16 -19
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/stats-pane.js +1 -15
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/demo.js +2 -2
- package/node_modules/toolcraft-design/dist/explorer/theme.js +29 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/index.d.ts +7 -1
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/index.js +4 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/theme-detect.d.ts +1 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/theme-detect.js +28 -6
- package/node_modules/toolcraft-design/dist/internal/theme-state.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/internal/theme-state.js +35 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/theme.d.ts +1 -1
- package/node_modules/toolcraft-design/dist/prompts/theme.js +15 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/frontmatter.js +50 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.js +5 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.d.ts +37 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.js +85 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/index.d.ts +2 -0
- package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/index.js +1 -0
- package/node_modules/toolcraft-design/package.json +42 -0
- package/package.json +10 -6
- package/node_modules/@poe-code/design-system/dist/explorer/theme.js +0 -97
- package/node_modules/@poe-code/design-system/dist/prompts/theme.js +0 -12
- package/node_modules/@poe-code/design-system/dist/tokens/colors.d.ts +0 -35
- package/node_modules/@poe-code/design-system/dist/tokens/colors.js +0 -34
- package/node_modules/@poe-code/design-system/package.json +0 -29
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/writer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/writer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/browser.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/browser.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/color.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/color.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/command-errors.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/command-errors.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/detail-card.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/detail-card.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter-plain.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter-plain.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/help-formatter.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/logger.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/logger.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/symbols.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/symbols.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/table.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/table.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/template.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/template.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/text.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/components/text.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/ansi.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/ansi.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/buffer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/buffer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/border.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/border.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/footer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/output-pane.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/components/stats-pane.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/dashboard.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/dashboard.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/demo.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/demo.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/keymap.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/keymap.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/layout.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/layout.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/should-use-dashboard.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/should-use-dashboard.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/snapshot.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/snapshot.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/store.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/store.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal-width.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal-width.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/terminal.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/types.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/dashboard/types.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/actions.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/actions.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/demo.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/events.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/events.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/filter.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/filter.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/jobs.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/jobs.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/keymap.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/keymap.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/layout.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/layout.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/reducer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/reducer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/detail.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/detail.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/footer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/footer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/header.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/header.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/list.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/list.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/modal.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/modal.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/test-fixtures.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/test-fixtures.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/text.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/render/text.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.test-helpers.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/runtime.test-helpers.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/state.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/state.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/explorer/theme.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/color-support.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/color-support.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/output-format.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/output-format.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/strip-ansi.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/internal/strip-ansi.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/cancel.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/cancel.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/intro.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/intro.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/log.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/log.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/note.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/note.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/outro.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/outro.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/spinner.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/prompts/primitives/spinner.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/menu.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/menu.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/spinner.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/static/spinner.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/ast.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/ast.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/demo-content.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/demo-content.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/index.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/block.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/block.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/frontmatter.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/inline.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser/inline.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/parser.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/renderer.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/renderer.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/testing/theme-render-fixture.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/terminal-markdown/testing/theme-render-fixture.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/spacing.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/spacing.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/typography.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/typography.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/widths.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/tokens/widths.js +0 -0
|
@@ -28,16 +28,23 @@ export const hostExecutionEnvFactory = {
|
|
|
28
28
|
},
|
|
29
29
|
shell() {
|
|
30
30
|
const shellSpec = openSpec.shellSpec;
|
|
31
|
+
const shellArgs = getOwnShellSpecProperty(shellSpec, "args");
|
|
32
|
+
const shellCwd = getOwnShellSpecProperty(shellSpec, "cwd");
|
|
33
|
+
const shellEnv = getOwnShellSpecProperty(shellSpec, "env");
|
|
34
|
+
const shellSignal = getOwnShellSpecProperty(shellSpec, "signal");
|
|
31
35
|
return createHostRunner().exec({
|
|
32
|
-
command: shellSpec
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
command: getOwnShellSpecProperty(shellSpec, "command") ??
|
|
37
|
+
openSpec.env.SHELL ??
|
|
38
|
+
process.env.SHELL ??
|
|
39
|
+
"sh",
|
|
40
|
+
...(shellArgs ? { args: shellArgs } : {}),
|
|
41
|
+
cwd: shellCwd ?? openSpec.cwd,
|
|
42
|
+
env: hasOwnShellSpecProperty(shellSpec, "env") ? shellEnv : openSpec.env,
|
|
36
43
|
stdin: "inherit",
|
|
37
44
|
stdout: "inherit",
|
|
38
45
|
stderr: "inherit",
|
|
39
46
|
tty: true,
|
|
40
|
-
signal:
|
|
47
|
+
...(shellSignal === undefined ? {} : { signal: shellSignal })
|
|
41
48
|
});
|
|
42
49
|
},
|
|
43
50
|
async close() { }
|
|
@@ -47,3 +54,9 @@ export const hostExecutionEnvFactory = {
|
|
|
47
54
|
throw new Error("host runtime does not support reattach");
|
|
48
55
|
}
|
|
49
56
|
};
|
|
57
|
+
function getOwnShellSpecProperty(shellSpec, name) {
|
|
58
|
+
return hasOwnShellSpecProperty(shellSpec, name) ? shellSpec[name] : undefined;
|
|
59
|
+
}
|
|
60
|
+
function hasOwnShellSpecProperty(shellSpec, name) {
|
|
61
|
+
return shellSpec !== undefined && Object.prototype.hasOwnProperty.call(shellSpec, name);
|
|
62
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { spawn as spawnChildProcess } from "node:child_process";
|
|
2
2
|
export function createHostRunner(options = {}) {
|
|
3
|
-
const
|
|
3
|
+
const runnerOptions = normalizeHostRunnerOptions(options);
|
|
4
|
+
const detachedByDefault = runnerOptions.detached === true;
|
|
4
5
|
return {
|
|
5
6
|
name: "host",
|
|
6
|
-
exec(
|
|
7
|
+
exec(inputSpec) {
|
|
8
|
+
const spec = normalizeRunSpec(inputSpec);
|
|
7
9
|
if (spec.signal?.aborted === true) {
|
|
8
10
|
return {
|
|
9
11
|
pid: null,
|
|
@@ -21,12 +23,12 @@ export function createHostRunner(options = {}) {
|
|
|
21
23
|
const stdio = stdinMode === "inherit" && stdoutMode === "inherit" && stderrMode === "inherit"
|
|
22
24
|
? "inherit"
|
|
23
25
|
: [stdinMode, stdoutMode, stderrMode];
|
|
24
|
-
const child = spawnChildProcess(spec.command, spec.args ?? [], {
|
|
26
|
+
const child = spawnChildProcess(spec.command, spec.args ?? [], createNullRecord({
|
|
25
27
|
cwd: spec.cwd,
|
|
26
28
|
env: spec.env,
|
|
27
29
|
stdio,
|
|
28
30
|
...(killProcessGroup ? { detached: true } : {})
|
|
29
|
-
});
|
|
31
|
+
}));
|
|
30
32
|
if (killProcessGroup) {
|
|
31
33
|
child.unref();
|
|
32
34
|
}
|
|
@@ -75,6 +77,38 @@ export function createHostRunner(options = {}) {
|
|
|
75
77
|
}
|
|
76
78
|
};
|
|
77
79
|
}
|
|
80
|
+
function normalizeHostRunnerOptions(options) {
|
|
81
|
+
return createNullRecord({
|
|
82
|
+
...optionalOwnProperty(options, "detached")
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function normalizeRunSpec(spec) {
|
|
86
|
+
return createNullRecord({
|
|
87
|
+
command: getOwnProperty(spec, "command"),
|
|
88
|
+
...optionalOwnProperty(spec, "args"),
|
|
89
|
+
...optionalOwnProperty(spec, "cwd"),
|
|
90
|
+
...optionalOwnProperty(spec, "env"),
|
|
91
|
+
...optionalOwnProperty(spec, "stdin"),
|
|
92
|
+
...optionalOwnProperty(spec, "stdout"),
|
|
93
|
+
...optionalOwnProperty(spec, "stderr"),
|
|
94
|
+
...optionalOwnProperty(spec, "tty"),
|
|
95
|
+
...optionalOwnProperty(spec, "signal"),
|
|
96
|
+
...optionalOwnProperty(spec, "killProcessGroup")
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function optionalOwnProperty(value, name) {
|
|
100
|
+
const property = getOwnProperty(value, name);
|
|
101
|
+
return property === undefined ? {} : { [name]: property };
|
|
102
|
+
}
|
|
103
|
+
function getOwnProperty(value, name) {
|
|
104
|
+
return hasOwnProperty(value, name) ? value[name] : undefined;
|
|
105
|
+
}
|
|
106
|
+
function hasOwnProperty(value, name) {
|
|
107
|
+
return Object.prototype.hasOwnProperty.call(value, name);
|
|
108
|
+
}
|
|
109
|
+
function createNullRecord(value) {
|
|
110
|
+
return Object.assign(Object.create(null), value);
|
|
111
|
+
}
|
|
78
112
|
function bindAbortSignal(signal, onAbort) {
|
|
79
113
|
if (signal === undefined) {
|
|
80
114
|
return () => { };
|
|
@@ -496,8 +496,14 @@ function stripSlashes(value) {
|
|
|
496
496
|
return value.slice(start, end);
|
|
497
497
|
}
|
|
498
498
|
function isNotFoundError(error) {
|
|
499
|
-
return
|
|
499
|
+
return hasOwnErrorCode(error, "ENOENT");
|
|
500
500
|
}
|
|
501
501
|
function isAlreadyExistsError(error) {
|
|
502
|
-
return
|
|
502
|
+
return hasOwnErrorCode(error, "EEXIST");
|
|
503
|
+
}
|
|
504
|
+
function hasOwnErrorCode(error, code) {
|
|
505
|
+
return (typeof error === "object" &&
|
|
506
|
+
error !== null &&
|
|
507
|
+
Object.prototype.hasOwnProperty.call(error, "code") &&
|
|
508
|
+
error.code === code);
|
|
503
509
|
}
|
|
@@ -328,20 +328,23 @@ function isExactStatusField(field) {
|
|
|
328
328
|
function isStatusOption(value) {
|
|
329
329
|
return (typeof value === "object" &&
|
|
330
330
|
value !== null &&
|
|
331
|
-
"id"
|
|
331
|
+
hasOwnProperty(value, "id") &&
|
|
332
332
|
typeof value.id === "string" &&
|
|
333
|
-
"name"
|
|
333
|
+
hasOwnProperty(value, "name") &&
|
|
334
334
|
typeof value.name === "string" &&
|
|
335
|
-
(!("color"
|
|
336
|
-
(!("description"
|
|
335
|
+
(!hasOwnProperty(value, "color") || typeof value.color === "string") &&
|
|
336
|
+
(!hasOwnProperty(value, "description") || typeof value.description === "string"));
|
|
337
337
|
}
|
|
338
338
|
function isStatusField(value) {
|
|
339
339
|
return (typeof value === "object" &&
|
|
340
340
|
value !== null &&
|
|
341
|
-
"id"
|
|
341
|
+
hasOwnProperty(value, "id") &&
|
|
342
342
|
typeof value.id === "string" &&
|
|
343
|
-
(!("name"
|
|
344
|
-
"options"
|
|
343
|
+
(!hasOwnProperty(value, "name") || typeof value.name === "string") &&
|
|
344
|
+
hasOwnProperty(value, "options") &&
|
|
345
345
|
Array.isArray(value.options) &&
|
|
346
346
|
value.options.every(isStatusOption));
|
|
347
347
|
}
|
|
348
|
+
function hasOwnProperty(value, name) {
|
|
349
|
+
return Object.prototype.hasOwnProperty.call(value, name);
|
|
350
|
+
}
|
|
@@ -139,29 +139,36 @@ function readFrontmatter(frontmatterContent, filePath) {
|
|
|
139
139
|
return parsed;
|
|
140
140
|
}
|
|
141
141
|
function assertValidTaskRecord(frontmatter, filePath, validStates) {
|
|
142
|
-
if ("$schema"
|
|
142
|
+
if (hasOwnTaskField(frontmatter, "$schema") && frontmatter.$schema !== TASK_SCHEMA_ID) {
|
|
143
143
|
throw malformedTask(filePath, "$schema");
|
|
144
144
|
}
|
|
145
|
-
if ("kind"
|
|
145
|
+
if (hasOwnTaskField(frontmatter, "kind") && frontmatter.kind !== TASK_KIND) {
|
|
146
146
|
throw malformedTask(filePath, "kind");
|
|
147
147
|
}
|
|
148
|
-
if ("version"
|
|
148
|
+
if (hasOwnTaskField(frontmatter, "version")) {
|
|
149
149
|
if (typeof frontmatter.version !== "number" ||
|
|
150
150
|
!Number.isInteger(frontmatter.version) ||
|
|
151
151
|
frontmatter.version !== TASK_VERSION) {
|
|
152
152
|
throw malformedTask(filePath, "version");
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
if (
|
|
155
|
+
if (!hasOwnTaskField(frontmatter, "name") ||
|
|
156
|
+
typeof frontmatter.name !== "string" ||
|
|
157
|
+
frontmatter.name.length === 0) {
|
|
156
158
|
throw malformedTask(filePath, "name");
|
|
157
159
|
}
|
|
158
|
-
if (
|
|
160
|
+
if (!hasOwnTaskField(frontmatter, "state") ||
|
|
161
|
+
typeof frontmatter.state !== "string" ||
|
|
162
|
+
!validStates.has(frontmatter.state)) {
|
|
159
163
|
throw malformedTask(filePath, "state");
|
|
160
164
|
}
|
|
161
|
-
if ("description"
|
|
165
|
+
if (hasOwnTaskField(frontmatter, "description") && typeof frontmatter.description !== "string") {
|
|
162
166
|
throw malformedTask(filePath, "description");
|
|
163
167
|
}
|
|
164
168
|
}
|
|
169
|
+
function hasOwnTaskField(frontmatter, key) {
|
|
170
|
+
return Object.prototype.hasOwnProperty.call(frontmatter, key);
|
|
171
|
+
}
|
|
165
172
|
function reservedFrontmatterKeys(mode) {
|
|
166
173
|
return mode === "passthrough" ? PASSTHROUGH_RESERVED_FRONTMATTER_KEYS : RESERVED_FRONTMATTER_KEYS;
|
|
167
174
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
export function compareCreated(left, right) {
|
|
3
4
|
const leftCreated = typeof left.raw.created === "string" ? left.raw.created : "";
|
|
@@ -20,11 +21,10 @@ export function applyOrder(entries, order) {
|
|
|
20
21
|
}
|
|
21
22
|
return entries.map((entry) => entry.task);
|
|
22
23
|
}
|
|
23
|
-
let tmpFileCounter = 0;
|
|
24
24
|
export function hasErrorCode(error, code) {
|
|
25
25
|
return (!!error &&
|
|
26
26
|
typeof error === "object" &&
|
|
27
|
-
"code"
|
|
27
|
+
Object.prototype.hasOwnProperty.call(error, "code") &&
|
|
28
28
|
error.code === code);
|
|
29
29
|
}
|
|
30
30
|
export function isRecord(value) {
|
|
@@ -78,20 +78,24 @@ export async function rejectSymbolicLinkComponents(fs, filePath) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
export async function writeAtomically(fs, filePath, content) {
|
|
81
|
-
const tempPath = `${filePath}
|
|
82
|
-
|
|
81
|
+
const tempPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
|
|
82
|
+
let tempCreated = false;
|
|
83
83
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
84
84
|
try {
|
|
85
85
|
await fs.writeFile(tempPath, content, { encoding: "utf8", flag: "wx" });
|
|
86
|
+
tempCreated = true;
|
|
86
87
|
await fs.rename(tempPath, filePath);
|
|
88
|
+
tempCreated = false;
|
|
87
89
|
}
|
|
88
90
|
catch (error) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
if (tempCreated || !hasErrorCode(error, "EEXIST")) {
|
|
92
|
+
try {
|
|
93
|
+
await fs.unlink(tempPath);
|
|
94
|
+
}
|
|
95
|
+
catch (unlinkError) {
|
|
96
|
+
if (!hasErrorCode(unlinkError, "ENOENT")) {
|
|
97
|
+
throw unlinkError;
|
|
98
|
+
}
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
throw error;
|
|
@@ -106,6 +110,7 @@ export async function withFileLock(fs, lockPath, operation) {
|
|
|
106
110
|
}
|
|
107
111
|
catch (error) {
|
|
108
112
|
if (!hasErrorCode(error, "EEXIST")) {
|
|
113
|
+
await fs.unlink(lockPath).catch(() => undefined);
|
|
109
114
|
throw error;
|
|
110
115
|
}
|
|
111
116
|
if (await removeAbandonedLock(fs, lockPath)) {
|
|
@@ -50,7 +50,8 @@ function parseQualifiedId(qualifiedId) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
function descriptionFromTaskRecord(taskRecord) {
|
|
53
|
-
|
|
53
|
+
const description = getOwnEntry(taskRecord, "description");
|
|
54
|
+
return typeof description === "string" ? description : "";
|
|
54
55
|
}
|
|
55
56
|
function metadataFromTaskRecord(taskRecord) {
|
|
56
57
|
const metadata = Object.create(null);
|
|
@@ -66,8 +67,8 @@ function createTask(list, id, taskRecord, sourcePath) {
|
|
|
66
67
|
list,
|
|
67
68
|
id,
|
|
68
69
|
qualifiedId: `${list}/${id}`,
|
|
69
|
-
name: taskRecord
|
|
70
|
-
state: taskRecord
|
|
70
|
+
name: getOwnEntry(taskRecord, "name"),
|
|
71
|
+
state: getOwnEntry(taskRecord, "state"),
|
|
71
72
|
description: descriptionFromTaskRecord(taskRecord),
|
|
72
73
|
metadata: metadataFromTaskRecord(taskRecord),
|
|
73
74
|
...(sourcePath !== undefined && { sourcePath: path.resolve(sourcePath) })
|
|
@@ -163,18 +164,19 @@ function assertValidStoreRecord(store, filePath) {
|
|
|
163
164
|
if (!isRecord(store)) {
|
|
164
165
|
throw malformedStore(filePath, "store");
|
|
165
166
|
}
|
|
166
|
-
if (store
|
|
167
|
+
if (getOwnEntry(store, "$schema") !== STORE_SCHEMA_ID) {
|
|
167
168
|
throw malformedStore(filePath, "$schema");
|
|
168
169
|
}
|
|
169
|
-
if (store
|
|
170
|
+
if (getOwnEntry(store, "kind") !== STORE_KIND) {
|
|
170
171
|
throw malformedStore(filePath, "kind");
|
|
171
172
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
const version = getOwnEntry(store, "version");
|
|
174
|
+
if (typeof version !== "number" ||
|
|
175
|
+
!Number.isInteger(version) ||
|
|
176
|
+
version !== STORE_VERSION) {
|
|
175
177
|
throw malformedStore(filePath, "version");
|
|
176
178
|
}
|
|
177
|
-
if (!isRecord(store
|
|
179
|
+
if (!isRecord(getOwnEntry(store, "lists"))) {
|
|
178
180
|
throw malformedStore(filePath, "lists");
|
|
179
181
|
}
|
|
180
182
|
}
|
|
@@ -182,31 +184,45 @@ function assertValidTaskRecord(taskRecord, list, id, validStates) {
|
|
|
182
184
|
if (!isRecord(taskRecord)) {
|
|
183
185
|
throw malformedTask(list, id, "task");
|
|
184
186
|
}
|
|
185
|
-
if ("$schema"
|
|
187
|
+
if (hasOwnTaskField(taskRecord, "$schema") && getOwnEntry(taskRecord, "$schema") !== TASK_SCHEMA_ID) {
|
|
186
188
|
throw malformedTask(list, id, "$schema");
|
|
187
189
|
}
|
|
188
|
-
if ("kind"
|
|
190
|
+
if (hasOwnTaskField(taskRecord, "kind") && getOwnEntry(taskRecord, "kind") !== TASK_KIND) {
|
|
189
191
|
throw malformedTask(list, id, "kind");
|
|
190
192
|
}
|
|
191
|
-
if ("version"
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
if (hasOwnTaskField(taskRecord, "version")) {
|
|
194
|
+
const version = getOwnEntry(taskRecord, "version");
|
|
195
|
+
if (typeof version !== "number" ||
|
|
196
|
+
!Number.isInteger(version) ||
|
|
197
|
+
version !== TASK_VERSION) {
|
|
195
198
|
throw malformedTask(list, id, "version");
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
|
-
|
|
201
|
+
const name = getOwnEntry(taskRecord, "name");
|
|
202
|
+
if (!hasOwnTaskField(taskRecord, "name") ||
|
|
203
|
+
typeof name !== "string" ||
|
|
204
|
+
name.length === 0) {
|
|
199
205
|
throw malformedTask(list, id, "name");
|
|
200
206
|
}
|
|
201
|
-
|
|
207
|
+
const state = getOwnEntry(taskRecord, "state");
|
|
208
|
+
if (!hasOwnTaskField(taskRecord, "state") ||
|
|
209
|
+
typeof state !== "string" ||
|
|
210
|
+
!validStates.has(state)) {
|
|
202
211
|
throw malformedTask(list, id, "state");
|
|
203
212
|
}
|
|
204
|
-
if (
|
|
213
|
+
if (hasOwnTaskField(taskRecord, "description") &&
|
|
214
|
+
typeof getOwnEntry(taskRecord, "description") !== "string") {
|
|
205
215
|
throw malformedTask(list, id, "description");
|
|
206
216
|
}
|
|
207
217
|
}
|
|
218
|
+
function hasOwnTaskField(taskRecord, key) {
|
|
219
|
+
return Object.prototype.hasOwnProperty.call(taskRecord, key);
|
|
220
|
+
}
|
|
221
|
+
function getOwnEntry(record, key) {
|
|
222
|
+
return Object.prototype.hasOwnProperty.call(record, key) ? record[key] : undefined;
|
|
223
|
+
}
|
|
208
224
|
function validateStoreEntries(store, filePath, validStates) {
|
|
209
|
-
const lists = store
|
|
225
|
+
const lists = getOwnEntry(store, "lists");
|
|
210
226
|
if (!isRecord(lists)) {
|
|
211
227
|
throw malformedStore(filePath, "lists");
|
|
212
228
|
}
|
|
@@ -247,10 +263,11 @@ async function readStore(fs, filePath, validStates) {
|
|
|
247
263
|
};
|
|
248
264
|
}
|
|
249
265
|
function getListsRecord(store) {
|
|
250
|
-
|
|
266
|
+
const lists = getOwnEntry(store, "lists");
|
|
267
|
+
return isRecord(lists) ? lists : {};
|
|
251
268
|
}
|
|
252
269
|
function getListRecord(store, list) {
|
|
253
|
-
const listRecord = getListsRecord(store)
|
|
270
|
+
const listRecord = getOwnEntry(getListsRecord(store), list);
|
|
254
271
|
return isRecord(listRecord) ? listRecord : undefined;
|
|
255
272
|
}
|
|
256
273
|
function getTaskRecord(store, list, id) {
|
|
@@ -546,7 +563,7 @@ export async function yamlFileBackend(deps) {
|
|
|
546
563
|
const result = [];
|
|
547
564
|
const listNames = sortStrings(Object.keys(getListsRecord(store)));
|
|
548
565
|
for (const listName of listNames) {
|
|
549
|
-
const listRecord = getListsRecord(store)
|
|
566
|
+
const listRecord = getOwnEntry(getListsRecord(store), listName);
|
|
550
567
|
if (!isRecord(listRecord))
|
|
551
568
|
continue;
|
|
552
569
|
const entries = Object.entries(listRecord)
|
|
@@ -115,7 +115,7 @@ async function applyState(tasks, created, events) {
|
|
|
115
115
|
return task;
|
|
116
116
|
}
|
|
117
117
|
function readOnlySourceOptions(options) {
|
|
118
|
-
if (!("create"
|
|
118
|
+
if (!hasOwnProperty(options, "create")) {
|
|
119
119
|
return options;
|
|
120
120
|
}
|
|
121
121
|
return { ...options, create: false };
|
|
@@ -213,3 +213,6 @@ function createTokenBucket(rate) {
|
|
|
213
213
|
function errorMessage(error) {
|
|
214
214
|
return error instanceof Error ? error.message : String(error);
|
|
215
215
|
}
|
|
216
|
+
function hasOwnProperty(value, key) {
|
|
217
|
+
return Object.prototype.hasOwnProperty.call(value, key);
|
|
218
|
+
}
|
|
@@ -13,48 +13,70 @@ function createDefaultFs() {
|
|
|
13
13
|
return fsPromises;
|
|
14
14
|
}
|
|
15
15
|
export async function openTaskList(options) {
|
|
16
|
-
|
|
16
|
+
const type = getOwnProperty(options, "type");
|
|
17
|
+
switch (type) {
|
|
17
18
|
case "markdown-dir":
|
|
18
19
|
case "yaml-file":
|
|
19
20
|
return openFileBackend(options);
|
|
20
21
|
case "gh-issues":
|
|
21
22
|
return openGhIssuesBackend(options);
|
|
22
23
|
default:
|
|
23
|
-
throw new Error(`Unknown task list backend type "${
|
|
24
|
+
throw new Error(`Unknown task list backend type "${String(type)}".`);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
async function openFileBackend(options) {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
28
|
+
const type = getOwnProperty(options, "type");
|
|
29
|
+
const factory = backendFactories[type];
|
|
30
|
+
const stateMachine = resolveStateMachine(getOwnProperty(options, "stateMachine"));
|
|
29
31
|
validateMachine(stateMachine);
|
|
30
|
-
const markdownOptions =
|
|
32
|
+
const markdownOptions = type === "markdown-dir" ? options : undefined;
|
|
33
|
+
const defaults = getOwnProperty(options, "defaults");
|
|
31
34
|
const deps = {
|
|
32
|
-
path: options
|
|
35
|
+
path: getOwnProperty(options, "path"),
|
|
33
36
|
defaults: {
|
|
34
|
-
metadata:
|
|
37
|
+
metadata: readDefaultMetadata(defaults)
|
|
35
38
|
},
|
|
36
|
-
singleList: markdownOptions
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
singleList: markdownOptions === undefined
|
|
40
|
+
? undefined
|
|
41
|
+
: getOwnProperty(markdownOptions, "singleList"),
|
|
42
|
+
frontmatterMode: markdownOptions === undefined
|
|
43
|
+
? "strict"
|
|
44
|
+
: (getOwnProperty(markdownOptions, "frontmatterMode") ?? "strict"),
|
|
45
|
+
create: getOwnProperty(options, "create") ?? false,
|
|
46
|
+
fs: getOwnProperty(options, "fs") ?? createDefaultFs(),
|
|
40
47
|
stateMachine
|
|
41
48
|
};
|
|
42
49
|
return factory(deps);
|
|
43
50
|
}
|
|
44
51
|
async function openGhIssuesBackend(options) {
|
|
45
|
-
const
|
|
52
|
+
const auth = getOwnProperty(options, "auth");
|
|
53
|
+
const explicitToken = auth && hasOwnProperty(auth, "token") ? auth.token : undefined;
|
|
46
54
|
const endpoint = resolveEndpoint();
|
|
55
|
+
const defaults = getOwnProperty(options, "defaults");
|
|
47
56
|
return ghIssuesBackend({
|
|
48
|
-
repo: options
|
|
49
|
-
project: options
|
|
50
|
-
filter: options
|
|
51
|
-
state: options
|
|
52
|
-
stateMachine: options
|
|
57
|
+
repo: getOwnProperty(options, "repo"),
|
|
58
|
+
project: getOwnProperty(options, "project"),
|
|
59
|
+
filter: getOwnProperty(options, "filter"),
|
|
60
|
+
state: getOwnProperty(options, "state"),
|
|
61
|
+
stateMachine: getOwnProperty(options, "stateMachine"),
|
|
53
62
|
defaults: {
|
|
54
|
-
metadata:
|
|
63
|
+
metadata: readDefaultMetadata(defaults)
|
|
55
64
|
},
|
|
56
|
-
token,
|
|
65
|
+
token: await resolveAuth({ explicitToken }),
|
|
57
66
|
endpoint,
|
|
58
|
-
fetch: options
|
|
67
|
+
fetch: getOwnProperty(options, "fetch")
|
|
59
68
|
});
|
|
60
69
|
}
|
|
70
|
+
function readDefaultMetadata(defaults) {
|
|
71
|
+
const metadata = defaults === undefined ? undefined : getOwnProperty(defaults, "metadata");
|
|
72
|
+
return isRecord(metadata) ? { ...metadata } : {};
|
|
73
|
+
}
|
|
74
|
+
function getOwnProperty(value, name) {
|
|
75
|
+
return hasOwnProperty(value, name) ? value[name] : undefined;
|
|
76
|
+
}
|
|
77
|
+
function hasOwnProperty(value, name) {
|
|
78
|
+
return Object.prototype.hasOwnProperty.call(value, name);
|
|
79
|
+
}
|
|
80
|
+
function isRecord(value) {
|
|
81
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
82
|
+
}
|
|
@@ -14,27 +14,27 @@ export function validateMachine(machine) {
|
|
|
14
14
|
if (!isRecord(machine)) {
|
|
15
15
|
throw new TypeError("State machine must be an object.");
|
|
16
16
|
}
|
|
17
|
-
if (!isStateList(machine.states)) {
|
|
17
|
+
if (!hasOwnRecordField(machine, "states") || !isStateList(machine.states)) {
|
|
18
18
|
throw new TypeError("State machine states must be a string array.");
|
|
19
19
|
}
|
|
20
20
|
const states = new Set(machine.states);
|
|
21
|
-
if (typeof machine.initial !== "string") {
|
|
21
|
+
if (!hasOwnRecordField(machine, "initial") || typeof machine.initial !== "string") {
|
|
22
22
|
throw new TypeError("State machine initial must be a string.");
|
|
23
23
|
}
|
|
24
24
|
if (!states.has(machine.initial)) {
|
|
25
25
|
throw new Error(`Initial state "${machine.initial}" is not declared.`);
|
|
26
26
|
}
|
|
27
|
-
if (!isRecord(machine.events)) {
|
|
27
|
+
if (!hasOwnRecordField(machine, "events") || !isRecord(machine.events)) {
|
|
28
28
|
throw new TypeError("State machine events must be an object.");
|
|
29
29
|
}
|
|
30
30
|
for (const [eventName, event] of Object.entries(machine.events)) {
|
|
31
31
|
if (!isRecord(event)) {
|
|
32
32
|
throw new TypeError(`Event "${eventName}" must be an object.`);
|
|
33
33
|
}
|
|
34
|
-
if (event.from !== "*" && !isStateList(event.from)) {
|
|
34
|
+
if (!hasOwnRecordField(event, "from") || (event.from !== "*" && !isStateList(event.from))) {
|
|
35
35
|
throw new TypeError(`Event "${eventName}" has an invalid "from" definition.`);
|
|
36
36
|
}
|
|
37
|
-
if (typeof event.to !== "string") {
|
|
37
|
+
if (!hasOwnRecordField(event, "to") || typeof event.to !== "string") {
|
|
38
38
|
throw new TypeError(`Event "${eventName}" target state must be a string.`);
|
|
39
39
|
}
|
|
40
40
|
if (!states.has(event.to)) {
|
|
@@ -49,6 +49,9 @@ export function validateMachine(machine) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
function hasOwnRecordField(record, key) {
|
|
53
|
+
return Object.prototype.hasOwnProperty.call(record, key);
|
|
54
|
+
}
|
|
52
55
|
export function eventsFromState(machine, fromState) {
|
|
53
56
|
const events = [];
|
|
54
57
|
for (const [eventName, event] of Object.entries(machine.events)) {
|
|
@@ -27,7 +27,7 @@ export function createSecretStore(input) {
|
|
|
27
27
|
}
|
|
28
28
|
function resolveBackend(input) {
|
|
29
29
|
const envVar = input.backendEnvVar ?? DEFAULT_BACKEND_ENV_VAR;
|
|
30
|
-
const configuredBackend = input.backend ?? input.env
|
|
30
|
+
const configuredBackend = input.backend ?? getOwnEnvValue(input.env, envVar) ?? getOwnEnvValue(process.env, envVar);
|
|
31
31
|
if (configuredBackend === "keychain") {
|
|
32
32
|
return "keychain";
|
|
33
33
|
}
|
|
@@ -36,3 +36,8 @@ function resolveBackend(input) {
|
|
|
36
36
|
}
|
|
37
37
|
throw new Error(`Unsupported auth store backend: ${configuredBackend}`);
|
|
38
38
|
}
|
|
39
|
+
function getOwnEnvValue(env, key) {
|
|
40
|
+
return env !== undefined && Object.prototype.hasOwnProperty.call(env, key)
|
|
41
|
+
? env[key]
|
|
42
|
+
: undefined;
|
|
43
|
+
}
|
|
@@ -42,6 +42,6 @@ export declare class EncryptedFileStore implements SecretStore {
|
|
|
42
42
|
get(): Promise<string | null>;
|
|
43
43
|
set(value: string): Promise<void>;
|
|
44
44
|
delete(): Promise<void>;
|
|
45
|
-
private
|
|
45
|
+
private assertCredentialPathHasNoSymbolicLinks;
|
|
46
46
|
private getEncryptionKey;
|
|
47
47
|
}
|