toolcraft 0.0.27 → 0.0.33
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/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/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/components.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/components.js +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/index.d.ts +0 -0
- /package/node_modules/{@poe-code/design-system → toolcraft-design}/dist/acp/index.js +0 -0
- /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
|
@@ -13,8 +13,14 @@ const ignoredRoot = defineGroup({
|
|
|
13
13
|
children: [ignoredCommand],
|
|
14
14
|
});
|
|
15
15
|
const ignoredOptions = {
|
|
16
|
-
approvals:
|
|
16
|
+
approvals: true,
|
|
17
17
|
casing: "kebab",
|
|
18
|
+
controls: {
|
|
19
|
+
debug: true,
|
|
20
|
+
output: true,
|
|
21
|
+
verbose: true,
|
|
22
|
+
yes: true,
|
|
23
|
+
},
|
|
18
24
|
humanInLoop: {},
|
|
19
25
|
version: "1.0.0",
|
|
20
26
|
};
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
+
import { configureTheme } from "toolcraft-design";
|
|
1
2
|
import type { Group } from "./index.js";
|
|
2
3
|
import { type ErrorReportsOption } from "./error-report.js";
|
|
3
4
|
import type { HumanInLoopRuntimeOptions } from "./human-in-loop/index.js";
|
|
5
|
+
export { configureTheme };
|
|
4
6
|
type Casing = "kebab" | "snake";
|
|
7
|
+
export interface CLIControls {
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
output?: boolean;
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
yes?: boolean;
|
|
12
|
+
}
|
|
5
13
|
export interface RunCLIOptions<TServices extends object = Record<string, unknown>> {
|
|
6
14
|
apiVersion?: string;
|
|
7
15
|
approvals?: boolean;
|
|
8
16
|
casing?: Casing;
|
|
17
|
+
controls?: CLIControls;
|
|
9
18
|
humanInLoop?: HumanInLoopRuntimeOptions;
|
|
10
19
|
projectRoot?: string;
|
|
11
20
|
rootDisplayName?: string;
|
|
@@ -16,4 +25,3 @@ export interface RunCLIOptions<TServices extends object = Record<string, unknown
|
|
|
16
25
|
errorReports?: ErrorReportsOption;
|
|
17
26
|
}
|
|
18
27
|
export declare function runCLI<TServices extends object = Record<string, unknown>>(roots: Group<TServices> | Group<TServices>[], options?: RunCLIOptions<TServices>): Promise<void>;
|
|
19
|
-
export {};
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { access, lstat, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Command as CommanderCommand, CommanderError, InvalidArgumentError, Option } from "commander";
|
|
4
|
-
import { cancel, confirm, createLogger, formatCommandList, formatOptionList, getTheme, helpFormatterPlain, isCancel, note, promptText, renderTable, resetOutputFormatCache, select, text } from "
|
|
4
|
+
import { cancel, configureTheme, confirm, createLogger, formatCommandList, formatOptionList, getTheme, helpFormatterPlain, isCancel, note, promptText, renderTable, resetOutputFormatCache, select, text } from "toolcraft-design";
|
|
5
5
|
import { ApprovalDeclinedError, UserError, assertCommandRequirements, getCommandSourcePath, resolveCommandSecrets } from "./index.js";
|
|
6
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
6
7
|
import { mergeApprovalsGroup } from "./human-in-loop/approvals-commands.js";
|
|
7
8
|
import { writeErrorReport } from "./error-report.js";
|
|
8
9
|
import { invokeWithHumanInLoop } from "./human-in-loop/index.js";
|
|
@@ -15,6 +16,8 @@ import { renderSourceSnippet } from "./source-snippet.js";
|
|
|
15
16
|
import { enableSourceMaps, formatDebugStack } from "./stack-trim.js";
|
|
16
17
|
import { suggest } from "./suggest.js";
|
|
17
18
|
import { throwValidationErrors } from "./validation-errors.js";
|
|
19
|
+
configureTheme({ brand: "blue", label: "Toolcraft" });
|
|
20
|
+
export { configureTheme };
|
|
18
21
|
const RESERVED_SERVICE_NAMES = new Set([
|
|
19
22
|
"params",
|
|
20
23
|
"secrets",
|
|
@@ -470,7 +473,7 @@ function getJsonParseErrorLocation(error, source) {
|
|
|
470
473
|
return null;
|
|
471
474
|
}
|
|
472
475
|
function getJsonParseCauseLocation(error) {
|
|
473
|
-
if (typeof error !== "object" || error === null || !("cause"
|
|
476
|
+
if (typeof error !== "object" || error === null || !hasOwnProperty(error, "cause")) {
|
|
474
477
|
return null;
|
|
475
478
|
}
|
|
476
479
|
const cause = error.cause;
|
|
@@ -482,13 +485,11 @@ function getJsonParseCauseLocation(error) {
|
|
|
482
485
|
return { line, column };
|
|
483
486
|
}
|
|
484
487
|
function getNumericProperty(value, key) {
|
|
485
|
-
if (typeof value !== "object" || value === null || !(key
|
|
488
|
+
if (typeof value !== "object" || value === null || !hasOwnProperty(value, key)) {
|
|
486
489
|
return null;
|
|
487
490
|
}
|
|
488
491
|
const propertyValue = value[key];
|
|
489
|
-
return typeof propertyValue === "number" && Number.isFinite(propertyValue)
|
|
490
|
-
? propertyValue
|
|
491
|
-
: null;
|
|
492
|
+
return typeof propertyValue === "number" && Number.isFinite(propertyValue) ? propertyValue : null;
|
|
492
493
|
}
|
|
493
494
|
function getJsonParseMessagePosition(message) {
|
|
494
495
|
const marker = " at position ";
|
|
@@ -608,11 +609,31 @@ function createOption(field, globalLongOptionFlags) {
|
|
|
608
609
|
const option = createCommanderOption(`${flags} <value>`, field.description, field);
|
|
609
610
|
return [option];
|
|
610
611
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
:
|
|
612
|
+
function resolveCLIControls(controls) {
|
|
613
|
+
return {
|
|
614
|
+
debug: controls?.debug === true,
|
|
615
|
+
output: controls?.output === true,
|
|
616
|
+
verbose: controls?.verbose === true,
|
|
617
|
+
yes: controls?.yes === true
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
function getGlobalLongOptionFlags(presetsEnabled, versionEnabled, controls) {
|
|
621
|
+
const flags = [];
|
|
622
|
+
if (presetsEnabled) {
|
|
623
|
+
flags.push("--preset");
|
|
624
|
+
}
|
|
625
|
+
if (controls.yes) {
|
|
626
|
+
flags.push("--yes");
|
|
627
|
+
}
|
|
628
|
+
if (controls.output) {
|
|
629
|
+
flags.push("--output");
|
|
630
|
+
}
|
|
631
|
+
if (controls.debug) {
|
|
632
|
+
flags.push("--debug");
|
|
633
|
+
}
|
|
634
|
+
if (controls.verbose) {
|
|
635
|
+
flags.push("--verbose");
|
|
636
|
+
}
|
|
616
637
|
if (versionEnabled) {
|
|
617
638
|
flags.push("--version");
|
|
618
639
|
}
|
|
@@ -971,11 +992,16 @@ function formatGlobalOptionsLine(ctx) {
|
|
|
971
992
|
if (ctx.presetsEnabled) {
|
|
972
993
|
flags.push("--preset <path>");
|
|
973
994
|
}
|
|
974
|
-
|
|
995
|
+
if (ctx.controls.yes) {
|
|
996
|
+
flags.push("--yes");
|
|
997
|
+
}
|
|
998
|
+
if (ctx.controls.output) {
|
|
999
|
+
flags.push("--output <format>");
|
|
1000
|
+
}
|
|
975
1001
|
if (ctx.showVersion) {
|
|
976
1002
|
flags.push("--version");
|
|
977
1003
|
}
|
|
978
|
-
return `${text.section("Options:")} ${flags.join(" ")}
|
|
1004
|
+
return flags.length > 0 ? `${text.section("Options:")} ${flags.join(" ")}` : "";
|
|
979
1005
|
}
|
|
980
1006
|
function collectSchemaGlobalFieldRows(group, scope, casing, globalLongOptionFlags) {
|
|
981
1007
|
const seen = new Map();
|
|
@@ -1011,12 +1037,12 @@ function renderHelpSections(sections) {
|
|
|
1011
1037
|
return sections.filter((section) => section.length > 0).join("\n\n");
|
|
1012
1038
|
}
|
|
1013
1039
|
function formatHelpCommandList(rows) {
|
|
1014
|
-
return process.stdout.isTTY
|
|
1040
|
+
return process.stdout.isTTY !== true
|
|
1015
1041
|
? helpFormatterPlain.formatCommandList(rows)
|
|
1016
1042
|
: formatCommandList(rows);
|
|
1017
1043
|
}
|
|
1018
1044
|
function formatHelpOptionList(rows) {
|
|
1019
|
-
return process.stdout.isTTY
|
|
1045
|
+
return process.stdout.isTTY !== true
|
|
1020
1046
|
? helpFormatterPlain.formatOptionList(rows)
|
|
1021
1047
|
: formatOptionList(rows);
|
|
1022
1048
|
}
|
|
@@ -1029,7 +1055,7 @@ function buildUsageLine(breadcrumb, rootUsageName, suffix) {
|
|
|
1029
1055
|
}
|
|
1030
1056
|
function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUsageName, isRoot) {
|
|
1031
1057
|
const sections = [];
|
|
1032
|
-
const globalLongOptionFlags = getGlobalLongOptionFlags(globalOptions.presetsEnabled, globalOptions.showVersion);
|
|
1058
|
+
const globalLongOptionFlags = getGlobalLongOptionFlags(globalOptions.presetsEnabled, globalOptions.showVersion, globalOptions.controls);
|
|
1033
1059
|
const commandRows = formatCommandRows(group, scope, casing, globalLongOptionFlags);
|
|
1034
1060
|
if (commandRows.length > 0) {
|
|
1035
1061
|
sections.push(`${text.sectionHeader("Commands")}\n${formatHelpCommandList(commandRows)}`);
|
|
@@ -1055,7 +1081,7 @@ function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUs
|
|
|
1055
1081
|
}
|
|
1056
1082
|
function renderLeafHelp(command, breadcrumb, casing, globalOptions, rootUsageName) {
|
|
1057
1083
|
const sections = [];
|
|
1058
|
-
const globalLongOptionFlags = getGlobalLongOptionFlags(globalOptions.presetsEnabled, globalOptions.showVersion);
|
|
1084
|
+
const globalLongOptionFlags = getGlobalLongOptionFlags(globalOptions.presetsEnabled, globalOptions.showVersion, globalOptions.controls);
|
|
1059
1085
|
const collected = collectFields(command.params, casing, globalLongOptionFlags);
|
|
1060
1086
|
const fields = assignPositionals(collected.fields, command.positional);
|
|
1061
1087
|
const optionRows = fields
|
|
@@ -1111,20 +1137,23 @@ async function renderGeneratedHelp(root, argv, options) {
|
|
|
1111
1137
|
const output = resolveHelpOutput(argv);
|
|
1112
1138
|
const casing = options.casing ?? "kebab";
|
|
1113
1139
|
const rootUsageName = options.rootUsageName ?? inferProgramName(argv);
|
|
1140
|
+
const controls = resolveCLIControls(options.controls);
|
|
1114
1141
|
await withOutputFormat(output, async () => {
|
|
1115
1142
|
const rendered = target.node.kind === "group"
|
|
1116
1143
|
? renderGroupHelp(target.node, target.breadcrumb, "cli", casing, {
|
|
1144
|
+
controls,
|
|
1117
1145
|
showVersion: options.version !== undefined,
|
|
1118
1146
|
presetsEnabled: options.presets === true
|
|
1119
1147
|
}, rootUsageName, target.node === root)
|
|
1120
1148
|
: renderLeafHelp(target.node, target.breadcrumb, casing, {
|
|
1149
|
+
controls,
|
|
1121
1150
|
showVersion: options.version !== undefined,
|
|
1122
1151
|
presetsEnabled: options.presets === true
|
|
1123
1152
|
}, rootUsageName);
|
|
1124
1153
|
process.stdout.write(rendered);
|
|
1125
1154
|
});
|
|
1126
1155
|
}
|
|
1127
|
-
function createNodeCommand(node, casing, globalLongOptionFlags, execute, presetsEnabled, pathSegments = []) {
|
|
1156
|
+
function createNodeCommand(node, casing, globalLongOptionFlags, execute, presetsEnabled, controls, pathSegments = []) {
|
|
1128
1157
|
const nextPathSegments = [...pathSegments, node.name];
|
|
1129
1158
|
if (node.kind === "command") {
|
|
1130
1159
|
if (!node.scope.includes("cli")) {
|
|
@@ -1139,7 +1168,7 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
|
|
|
1139
1168
|
}
|
|
1140
1169
|
node.aliases.forEach((alias) => command.alias(alias));
|
|
1141
1170
|
command.addHelpCommand(false);
|
|
1142
|
-
addGlobalOptions(command, presetsEnabled);
|
|
1171
|
+
addGlobalOptions(command, presetsEnabled, controls);
|
|
1143
1172
|
command.allowExcessArguments(true);
|
|
1144
1173
|
if (collected.dynamicFields.length > 0) {
|
|
1145
1174
|
command.allowUnknownOption(true);
|
|
@@ -1175,7 +1204,7 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
|
|
|
1175
1204
|
return null;
|
|
1176
1205
|
}
|
|
1177
1206
|
const visibleChildren = node.children
|
|
1178
|
-
.map((child) => createNodeCommand(child, casing, globalLongOptionFlags, execute, presetsEnabled, nextPathSegments))
|
|
1207
|
+
.map((child) => createNodeCommand(child, casing, globalLongOptionFlags, execute, presetsEnabled, controls, nextPathSegments))
|
|
1179
1208
|
.filter((child) => child !== null);
|
|
1180
1209
|
const group = new CommanderCommand(node.name);
|
|
1181
1210
|
if (node.description !== undefined) {
|
|
@@ -1183,37 +1212,60 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
|
|
|
1183
1212
|
}
|
|
1184
1213
|
node.aliases.forEach((alias) => group.alias(alias));
|
|
1185
1214
|
group.addHelpCommand(false);
|
|
1186
|
-
addGlobalOptions(group, presetsEnabled);
|
|
1215
|
+
addGlobalOptions(group, presetsEnabled, controls);
|
|
1216
|
+
const childNames = new Set(visibleChildren.map((child) => child.name()));
|
|
1187
1217
|
for (const child of visibleChildren) {
|
|
1188
1218
|
const isDefaultChild = node.default !== undefined &&
|
|
1189
1219
|
node.default.scope.includes("cli") &&
|
|
1190
1220
|
(child.name() === node.default.name || child.aliases().includes(node.default.name));
|
|
1191
|
-
group
|
|
1221
|
+
addCommanderChild(group, child, isDefaultChild, childNames);
|
|
1192
1222
|
}
|
|
1193
1223
|
return group;
|
|
1194
1224
|
}
|
|
1195
|
-
function
|
|
1225
|
+
function addCommanderChild(parent, child, isDefault, siblingNames) {
|
|
1226
|
+
if (isDefault && child.name().length === 0) {
|
|
1227
|
+
let internalName = "__toolcraft_default__";
|
|
1228
|
+
let suffix = 2;
|
|
1229
|
+
while (siblingNames.has(internalName)) {
|
|
1230
|
+
internalName = `__toolcraft_default_${suffix}`;
|
|
1231
|
+
suffix += 1;
|
|
1232
|
+
}
|
|
1233
|
+
child.name(internalName);
|
|
1234
|
+
parent.addCommand(child, { hidden: true, isDefault: true });
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
parent.addCommand(child, isDefault ? { isDefault: true } : undefined);
|
|
1238
|
+
}
|
|
1239
|
+
function addGlobalOptions(command, presetsEnabled, controls) {
|
|
1196
1240
|
const options = [];
|
|
1197
1241
|
if (presetsEnabled) {
|
|
1198
1242
|
options.push(new Option("--preset <path>", "Load parameter defaults from a JSON file."));
|
|
1199
1243
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1244
|
+
if (controls.yes) {
|
|
1245
|
+
options.push(new Option("--yes", "Accept defaults and skip prompts."));
|
|
1246
|
+
}
|
|
1247
|
+
if (controls.output) {
|
|
1248
|
+
options.push(new Option("--output <format>", "Output format.").argParser((value) => {
|
|
1249
|
+
if (value === "rich" || value === "md" || value === "json") {
|
|
1250
|
+
return value;
|
|
1251
|
+
}
|
|
1252
|
+
if (value === "markdown") {
|
|
1253
|
+
return "md";
|
|
1254
|
+
}
|
|
1255
|
+
throw new InvalidArgumentError(formatInvalidEnumMessage("--output", value, ["rich", "md", "markdown", "json"], {
|
|
1256
|
+
candidates: ["rich", "markdown", "json"],
|
|
1257
|
+
threshold: 3
|
|
1258
|
+
}));
|
|
1211
1259
|
}));
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
.
|
|
1215
|
-
|
|
1216
|
-
|
|
1260
|
+
}
|
|
1261
|
+
if (controls.debug) {
|
|
1262
|
+
options.push(new Option("--debug [mode]", "Print stack traces for unexpected errors.")
|
|
1263
|
+
.preset("trim")
|
|
1264
|
+
.argParser(parseDebugStackMode));
|
|
1265
|
+
}
|
|
1266
|
+
if (controls.verbose) {
|
|
1267
|
+
options.push(new Option("--verbose", "Print detailed runtime diagnostics."));
|
|
1268
|
+
}
|
|
1217
1269
|
for (const option of options) {
|
|
1218
1270
|
option.hideHelp(true);
|
|
1219
1271
|
command.addOption(option);
|
|
@@ -1270,13 +1322,20 @@ function formatResolvedValue(value) {
|
|
|
1270
1322
|
function fieldPromptLabel(field) {
|
|
1271
1323
|
return field.positionalIndex === undefined ? field.optionFlag : `<${field.displayPath}>`;
|
|
1272
1324
|
}
|
|
1325
|
+
function enumOptionLabel(schema, value) {
|
|
1326
|
+
const key = String(value);
|
|
1327
|
+
if (schema.labels === undefined || !Object.prototype.hasOwnProperty.call(schema.labels, key)) {
|
|
1328
|
+
return key;
|
|
1329
|
+
}
|
|
1330
|
+
return schema.labels[key] ?? key;
|
|
1331
|
+
}
|
|
1273
1332
|
async function promptForField(field) {
|
|
1274
1333
|
const schema = field.schema;
|
|
1275
1334
|
if (schema.kind === "enum") {
|
|
1276
1335
|
const options = schema.loadOptions
|
|
1277
1336
|
? await schema.loadOptions()
|
|
1278
1337
|
: schema.values.map((value) => ({
|
|
1279
|
-
label: schema
|
|
1338
|
+
label: enumOptionLabel(schema, value),
|
|
1280
1339
|
value
|
|
1281
1340
|
}));
|
|
1282
1341
|
const selected = await select({
|
|
@@ -1365,8 +1424,8 @@ async function withOutputFormat(output, fn) {
|
|
|
1365
1424
|
function createFs() {
|
|
1366
1425
|
return {
|
|
1367
1426
|
readFile: async (path, encoding = "utf8") => readFile(path, { encoding }),
|
|
1368
|
-
writeFile: async (path, contents) => {
|
|
1369
|
-
await writeFile(path, contents);
|
|
1427
|
+
writeFile: async (path, contents, options) => {
|
|
1428
|
+
await writeFile(path, contents, options);
|
|
1370
1429
|
},
|
|
1371
1430
|
exists: async (path) => {
|
|
1372
1431
|
try {
|
|
@@ -1468,7 +1527,7 @@ async function loadPresetValues(fields, presetPath) {
|
|
|
1468
1527
|
});
|
|
1469
1528
|
}
|
|
1470
1529
|
catch (error) {
|
|
1471
|
-
if (
|
|
1530
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
1472
1531
|
throw new UserError(`Preset file "${presetPath}" was not found.`);
|
|
1473
1532
|
}
|
|
1474
1533
|
const message = error instanceof Error && error.message.length > 0 ? error.message : "Unknown read error.";
|
|
@@ -2492,10 +2551,10 @@ function isHttpErrorLike(error) {
|
|
|
2492
2551
|
typeof response.status === "number" &&
|
|
2493
2552
|
typeof response.statusText === "string" &&
|
|
2494
2553
|
isStringRecord(response.headers) &&
|
|
2495
|
-
"body"
|
|
2554
|
+
hasOwnProperty(response, "body"));
|
|
2496
2555
|
}
|
|
2497
2556
|
function hasTypedOptionalField(value, field, type) {
|
|
2498
|
-
return !(field
|
|
2557
|
+
return !hasOwnProperty(value, field) || typeof value[field] === type;
|
|
2499
2558
|
}
|
|
2500
2559
|
function isNonEmptyString(value) {
|
|
2501
2560
|
return typeof value === "string" && value.trim().length > 0;
|
|
@@ -2519,7 +2578,7 @@ function isProblemDetailsLike(body) {
|
|
|
2519
2578
|
if (!hasTypedOptionalField(body, "instance", "string")) {
|
|
2520
2579
|
return false;
|
|
2521
2580
|
}
|
|
2522
|
-
return
|
|
2581
|
+
return hasOwnNonEmptyString(body, "title") || hasOwnNonEmptyString(body, "detail");
|
|
2523
2582
|
}
|
|
2524
2583
|
function isGraphQLErrorEnvelopeLike(body) {
|
|
2525
2584
|
if (!isPlainObject(body) || !Array.isArray(body.errors) || body.errors.length === 0) {
|
|
@@ -2529,45 +2588,51 @@ function isGraphQLErrorEnvelopeLike(body) {
|
|
|
2529
2588
|
if (!isPlainObject(error) || typeof error.message !== "string") {
|
|
2530
2589
|
return false;
|
|
2531
2590
|
}
|
|
2532
|
-
if ("path"
|
|
2591
|
+
if (hasOwnProperty(error, "path")) {
|
|
2533
2592
|
const pathValue = error.path;
|
|
2534
2593
|
if (!Array.isArray(pathValue) ||
|
|
2535
2594
|
!pathValue.every((entry) => typeof entry === "string" || typeof entry === "number")) {
|
|
2536
2595
|
return false;
|
|
2537
2596
|
}
|
|
2538
2597
|
}
|
|
2539
|
-
if ("extensions"
|
|
2598
|
+
if (hasOwnProperty(error, "extensions")) {
|
|
2540
2599
|
if (!isPlainObject(error.extensions)) {
|
|
2541
2600
|
return false;
|
|
2542
2601
|
}
|
|
2543
|
-
if ("code"
|
|
2602
|
+
if (hasOwnProperty(error.extensions, "code") && typeof error.extensions.code !== "string") {
|
|
2544
2603
|
return false;
|
|
2545
2604
|
}
|
|
2546
2605
|
}
|
|
2547
2606
|
return true;
|
|
2548
2607
|
});
|
|
2549
2608
|
}
|
|
2609
|
+
function hasOwnProperty(value, name) {
|
|
2610
|
+
return Object.prototype.hasOwnProperty.call(value, name);
|
|
2611
|
+
}
|
|
2612
|
+
function hasOwnNonEmptyString(value, name) {
|
|
2613
|
+
return hasOwnProperty(value, name) && isNonEmptyString(value[name]);
|
|
2614
|
+
}
|
|
2550
2615
|
function styleHttpErrorLine(value, style) {
|
|
2551
|
-
return process.stdout.isTTY
|
|
2616
|
+
return process.stdout.isTTY !== true ? value : style(value);
|
|
2552
2617
|
}
|
|
2553
2618
|
function formatHttpErrorStatus(value) {
|
|
2554
2619
|
return styleHttpErrorLine(value, text.error);
|
|
2555
2620
|
}
|
|
2556
2621
|
function formatProblemDetailsBody(body) {
|
|
2557
2622
|
const lines = [];
|
|
2558
|
-
if (
|
|
2623
|
+
if (hasOwnNonEmptyString(body, "title")) {
|
|
2559
2624
|
lines.push(`Problem: ${body.title}`);
|
|
2560
2625
|
}
|
|
2561
|
-
if (
|
|
2626
|
+
if (hasOwnNonEmptyString(body, "detail")) {
|
|
2562
2627
|
lines.push(`Detail: ${body.detail}`);
|
|
2563
2628
|
}
|
|
2564
|
-
if (body.type !== undefined) {
|
|
2629
|
+
if (hasOwnProperty(body, "type") && body.type !== undefined) {
|
|
2565
2630
|
lines.push(`Type: ${body.type}`);
|
|
2566
2631
|
}
|
|
2567
|
-
if (body.instance !== undefined) {
|
|
2632
|
+
if (hasOwnProperty(body, "instance") && body.instance !== undefined) {
|
|
2568
2633
|
lines.push(`Instance: ${body.instance}`);
|
|
2569
2634
|
}
|
|
2570
|
-
if (body.status !== undefined) {
|
|
2635
|
+
if (hasOwnProperty(body, "status") && body.status !== undefined) {
|
|
2571
2636
|
lines.push(`Status: ${body.status}`);
|
|
2572
2637
|
}
|
|
2573
2638
|
return lines.join("\n");
|
|
@@ -2576,10 +2641,13 @@ function formatGraphQLErrorEnvelopeBody(body) {
|
|
|
2576
2641
|
return body.errors
|
|
2577
2642
|
.map((error) => {
|
|
2578
2643
|
const lines = [`GraphQL error: ${error.message}`];
|
|
2579
|
-
if (error.path !== undefined) {
|
|
2644
|
+
if (hasOwnProperty(error, "path") && error.path !== undefined) {
|
|
2580
2645
|
lines.push(` at path: ${error.path.join(".")}`);
|
|
2581
2646
|
}
|
|
2582
|
-
if (error
|
|
2647
|
+
if (hasOwnProperty(error, "extensions") &&
|
|
2648
|
+
error.extensions !== undefined &&
|
|
2649
|
+
hasOwnProperty(error.extensions, "code") &&
|
|
2650
|
+
error.extensions.code !== undefined) {
|
|
2583
2651
|
lines.push(` code: ${error.extensions.code}`);
|
|
2584
2652
|
}
|
|
2585
2653
|
return lines.join("\n");
|
|
@@ -2882,13 +2950,14 @@ function configureCommanderSuggestionOutput(command) {
|
|
|
2882
2950
|
export async function runCLI(roots, options = {}) {
|
|
2883
2951
|
enableSourceMaps();
|
|
2884
2952
|
const normalizedRoot = normalizeRoots(roots, process.argv);
|
|
2885
|
-
const root = options.approvals ===
|
|
2953
|
+
const root = options.approvals === true ? mergeApprovalsGroup(normalizedRoot) : normalizedRoot;
|
|
2886
2954
|
await resolveMcpProxies(root, { projectRoot: options.projectRoot });
|
|
2887
2955
|
const casing = options.casing ?? "kebab";
|
|
2888
2956
|
const services = (options.services ?? {});
|
|
2889
2957
|
const runtimeOptions = options.humanInLoop ?? {};
|
|
2890
2958
|
const version = options.version ?? findEntrypointPackageMetadata(process.argv[1])?.version;
|
|
2891
2959
|
const rootUsageName = options.rootUsageName ?? inferProgramName(process.argv);
|
|
2960
|
+
const controls = resolveCLIControls(options.controls);
|
|
2892
2961
|
const servicesWithBuiltIns = {
|
|
2893
2962
|
...services,
|
|
2894
2963
|
runtimeOptions,
|
|
@@ -2908,8 +2977,8 @@ export async function runCLI(roots, options = {}) {
|
|
|
2908
2977
|
program.showHelpAfterError();
|
|
2909
2978
|
program.addHelpCommand(false);
|
|
2910
2979
|
const presetsEnabled = options.presets === true;
|
|
2911
|
-
const globalLongOptionFlags = getGlobalLongOptionFlags(presetsEnabled, version !== undefined);
|
|
2912
|
-
addGlobalOptions(program, presetsEnabled);
|
|
2980
|
+
const globalLongOptionFlags = getGlobalLongOptionFlags(presetsEnabled, version !== undefined, controls);
|
|
2981
|
+
addGlobalOptions(program, presetsEnabled, controls);
|
|
2913
2982
|
if (version !== undefined) {
|
|
2914
2983
|
program.version(version, "--version");
|
|
2915
2984
|
}
|
|
@@ -2923,15 +2992,18 @@ export async function runCLI(roots, options = {}) {
|
|
|
2923
2992
|
errorReportContext = context;
|
|
2924
2993
|
});
|
|
2925
2994
|
};
|
|
2995
|
+
const rootChildNames = new Set(root.children
|
|
2996
|
+
.filter((candidate) => isNodeVisibleInScope(candidate, "cli"))
|
|
2997
|
+
.map((candidate) => candidate.name));
|
|
2926
2998
|
for (const child of root.children) {
|
|
2927
|
-
const command = createNodeCommand(child, casing, globalLongOptionFlags, execute, presetsEnabled);
|
|
2999
|
+
const command = createNodeCommand(child, casing, globalLongOptionFlags, execute, presetsEnabled, controls);
|
|
2928
3000
|
if (command === null) {
|
|
2929
3001
|
continue;
|
|
2930
3002
|
}
|
|
2931
3003
|
const isDefaultChild = root.default !== undefined &&
|
|
2932
3004
|
root.default.scope.includes("cli") &&
|
|
2933
3005
|
(command.name() === root.default.name || command.aliases().includes(root.default.name));
|
|
2934
|
-
program
|
|
3006
|
+
addCommanderChild(program, command, isDefaultChild, rootChildNames);
|
|
2935
3007
|
}
|
|
2936
3008
|
configureCommanderSuggestionOutput(program);
|
|
2937
3009
|
const unknownCommand = findUnknownCommanderCommand(program, process.argv);
|
package/dist/design.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "toolcraft-design";
|
package/dist/design.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "toolcraft-design";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasOwnErrorCode(error: unknown, code: string): error is NodeJS.ErrnoException;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TaskNotFoundError } from "@poe-code/task-list";
|
|
2
2
|
import { S } from "toolcraft-schema";
|
|
3
|
+
import { hasOwnErrorCode } from "../error-codes.js";
|
|
3
4
|
import { UserError, defineCommand, defineGroup } from "../index.js";
|
|
4
5
|
import { ensureApprovalList } from "./approval-tasks.js";
|
|
5
6
|
import { runApproval } from "./runner.js";
|
|
@@ -231,5 +232,5 @@ function escapeMarkdownCell(value) {
|
|
|
231
232
|
return value.replaceAll("|", "\\|");
|
|
232
233
|
}
|
|
233
234
|
function isMissingStateError(error) {
|
|
234
|
-
return
|
|
235
|
+
return hasOwnErrorCode(error, "ENOENT");
|
|
235
236
|
}
|
|
@@ -184,8 +184,8 @@ function createHandlerContext(command, params) {
|
|
|
184
184
|
function createFs() {
|
|
185
185
|
return {
|
|
186
186
|
readFile: async (path, encoding = "utf8") => readFile(path, { encoding }),
|
|
187
|
-
writeFile: async (path, contents) => {
|
|
188
|
-
await writeFile(path, contents);
|
|
187
|
+
writeFile: async (path, contents, options) => {
|
|
188
|
+
await writeFile(path, contents, options);
|
|
189
189
|
},
|
|
190
190
|
exists: async (path) => {
|
|
191
191
|
try {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { McpServerConfig } from "@poe-code/agent-mcp-config";
|
|
2
2
|
import type { ObjectSchema, Static } from "toolcraft-schema";
|
|
3
|
-
import type { LoggerOutput, RenderTableOptions, ThemePalette } from "
|
|
3
|
+
import type { LoggerOutput, RenderTableOptions, ThemePalette } from "toolcraft-design";
|
|
4
4
|
import { ApprovalDeclinedError } from "./human-in-loop/types.js";
|
|
5
5
|
import type { HumanInLoopConfig, HumanInLoopPending, HumanInLoopRuntimeOptions } from "./human-in-loop/types.js";
|
|
6
6
|
import { ToolcraftBugError, UserError } from "./user-error.js";
|
|
@@ -33,7 +33,11 @@ export type InferSecrets<TSecrets extends SecretDeclarations | undefined> = TSec
|
|
|
33
33
|
} : Record<string, never>;
|
|
34
34
|
export interface HandlerFs {
|
|
35
35
|
readFile(path: string, encoding?: BufferEncoding): Promise<string>;
|
|
36
|
-
writeFile(path: string, contents: string
|
|
36
|
+
writeFile(path: string, contents: string, options?: {
|
|
37
|
+
encoding?: BufferEncoding;
|
|
38
|
+
flag?: string;
|
|
39
|
+
mode?: number;
|
|
40
|
+
}): Promise<void>;
|
|
37
41
|
exists(path: string): Promise<boolean>;
|
|
38
42
|
lstat(path: string): Promise<{
|
|
39
43
|
isSymbolicLink(): boolean;
|
|
@@ -152,7 +152,7 @@ function convertObjectSchema(schema, root, options) {
|
|
|
152
152
|
"properties",
|
|
153
153
|
key
|
|
154
154
|
]);
|
|
155
|
-
shape
|
|
155
|
+
setOwnShapeProperty(shape, key, requiredKeys.has(key) ? convertedProperty : S.Optional(convertedProperty));
|
|
156
156
|
}
|
|
157
157
|
return applyMetadata(S.Object(shape, {
|
|
158
158
|
...(typeof normalizedSchema.schema.additionalProperties === "boolean"
|
|
@@ -162,6 +162,14 @@ function convertObjectSchema(schema, root, options) {
|
|
|
162
162
|
nullable: options.nullable ?? normalizedSchema.nullable
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
+
function setOwnShapeProperty(shape, key, value) {
|
|
166
|
+
Object.defineProperty(shape, key, {
|
|
167
|
+
configurable: true,
|
|
168
|
+
enumerable: true,
|
|
169
|
+
writable: true,
|
|
170
|
+
value
|
|
171
|
+
});
|
|
172
|
+
}
|
|
165
173
|
function createCommonOptions(schema, nullable, defaultValue) {
|
|
166
174
|
return {
|
|
167
175
|
...(schema.description === undefined ? {} : { description: schema.description }),
|
|
@@ -408,6 +416,9 @@ function resolveLocalRef(root, ref) {
|
|
|
408
416
|
if (!isPlainObject(current)) {
|
|
409
417
|
return undefined;
|
|
410
418
|
}
|
|
419
|
+
if (!Object.prototype.hasOwnProperty.call(current, segment)) {
|
|
420
|
+
return undefined;
|
|
421
|
+
}
|
|
411
422
|
current = current[segment];
|
|
412
423
|
}
|
|
413
424
|
return isPlainObject(current) ? current : undefined;
|
package/dist/mcp-proxy.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { lstat, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import { lstat, mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
-
import { createLogger } from "
|
|
5
|
+
import { createLogger } from "toolcraft-design";
|
|
6
6
|
import { HttpTransport, McpClient, StdioTransport } from "tiny-mcp-client";
|
|
7
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
7
8
|
import { convertJsonSchema } from "./json-schema-converter.js";
|
|
8
9
|
const GROUP_CONFIG_SYMBOL_DESCRIPTION = "toolcraft.group.config";
|
|
9
10
|
const MCP_PROXY_SCHEMA_URL = "https://poe-platform.github.io/poe-code/schemas/toolcraft/mcp-proxy.schema.json";
|
|
@@ -175,8 +176,7 @@ async function readCache(cachePath) {
|
|
|
175
176
|
};
|
|
176
177
|
}
|
|
177
178
|
catch (error) {
|
|
178
|
-
|
|
179
|
-
if (code === "ENOENT" || error instanceof SyntaxError) {
|
|
179
|
+
if (hasOwnErrorCode(error, "ENOENT") || error instanceof SyntaxError) {
|
|
180
180
|
return undefined;
|
|
181
181
|
}
|
|
182
182
|
return undefined;
|
|
@@ -185,14 +185,31 @@ async function readCache(cachePath) {
|
|
|
185
185
|
async function writeCache(cachePath, cache) {
|
|
186
186
|
const directory = path.dirname(cachePath);
|
|
187
187
|
const tempPath = `${cachePath}.tmp-${randomUUID()}`;
|
|
188
|
+
let tempCreated = false;
|
|
188
189
|
await assertCachePathHasNoSymlinks(cachePath);
|
|
189
190
|
await assertCachePathHasNoSymlinks(tempPath);
|
|
190
191
|
await mkdir(directory, { recursive: true });
|
|
191
192
|
await assertCachePathHasNoSymlinks(directory);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
try {
|
|
194
|
+
await writeFile(tempPath, `${JSON.stringify(cache, null, 2)}\n`, {
|
|
195
|
+
encoding: "utf8",
|
|
196
|
+
flag: "wx"
|
|
197
|
+
});
|
|
198
|
+
tempCreated = true;
|
|
199
|
+
await assertCachePathHasNoSymlinks(tempPath);
|
|
200
|
+
await assertCachePathHasNoSymlinks(cachePath);
|
|
201
|
+
await rename(tempPath, cachePath);
|
|
202
|
+
tempCreated = false;
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (tempCreated || !isAlreadyExistsError(error)) {
|
|
206
|
+
await unlink(tempPath).catch(() => undefined);
|
|
207
|
+
}
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function isAlreadyExistsError(error) {
|
|
212
|
+
return hasOwnErrorCode(error, "EEXIST");
|
|
196
213
|
}
|
|
197
214
|
async function fetchCache(name, config) {
|
|
198
215
|
const logger = createLogger((message) => {
|
|
@@ -402,7 +419,7 @@ async function assertCachePathHasNoSymlinks(filePath) {
|
|
|
402
419
|
}
|
|
403
420
|
}
|
|
404
421
|
catch (error) {
|
|
405
|
-
if (error
|
|
422
|
+
if (!hasOwnErrorCode(error, "ENOENT")) {
|
|
406
423
|
throw error;
|
|
407
424
|
}
|
|
408
425
|
}
|