toolcraft 0.0.26 → 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/error-report.js +99 -29
- 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 +18 -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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { claudeCodeAgent } from "./claude-code.js";
|
|
2
2
|
export { claudeDesktopAgent } from "./claude-desktop.js";
|
|
3
3
|
export { codexAgent } from "./codex.js";
|
|
4
|
+
export { cursorAgent } from "./cursor.js";
|
|
4
5
|
export { geminiCliAgent } from "./gemini-cli.js";
|
|
5
6
|
export { openCodeAgent } from "./opencode.js";
|
|
6
7
|
export { kimiAgent } from "./kimi.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { claudeCodeAgent } from "./claude-code.js";
|
|
2
2
|
export { claudeDesktopAgent } from "./claude-desktop.js";
|
|
3
3
|
export { codexAgent } from "./codex.js";
|
|
4
|
+
export { cursorAgent } from "./cursor.js";
|
|
4
5
|
export { geminiCliAgent } from "./gemini-cli.js";
|
|
5
6
|
export { openCodeAgent } from "./opencode.js";
|
|
6
7
|
export { kimiAgent } from "./kimi.js";
|
|
@@ -5,6 +5,11 @@ export const openCodeAgent = {
|
|
|
5
5
|
summary: "Configure OpenCode CLI to use the Poe API.",
|
|
6
6
|
binaryName: "opencode",
|
|
7
7
|
apiShapes: ["openai-chat-completions"],
|
|
8
|
+
otelCapture: {
|
|
9
|
+
env: {
|
|
10
|
+
OPENCODE_CONFIG_CONTENT: '{"experimental":{"openTelemetry":true}}'
|
|
11
|
+
}
|
|
12
|
+
},
|
|
8
13
|
configPath: "~/.config/opencode/config.json",
|
|
9
14
|
branding: {
|
|
10
15
|
colors: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { AgentDefinition, ApiShapeId } from "./types.js";
|
|
1
|
+
export type { AgentDefinition, ApiShapeId, OtelCaptureDefinition } from "./types.js";
|
|
2
2
|
export type { AgentSpecifier } from "./specifier.js";
|
|
3
|
-
export { claudeCodeAgent, claudeDesktopAgent, codexAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
|
|
3
|
+
export { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
|
|
4
4
|
export { allAgents, resolveAgentId } from "./registry.js";
|
|
5
5
|
export { parseAgentSpecifier, formatAgentSpecifier, normalizeAgentId } from "./specifier.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { claudeCodeAgent, claudeDesktopAgent, codexAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
|
|
1
|
+
export { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
|
|
2
2
|
export { allAgents, resolveAgentId } from "./registry.js";
|
|
3
3
|
export { parseAgentSpecifier, formatAgentSpecifier, normalizeAgentId } from "./specifier.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { claudeCodeAgent, claudeDesktopAgent, codexAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
|
|
1
|
+
import { claudeCodeAgent, claudeDesktopAgent, codexAgent, cursorAgent, geminiCliAgent, openCodeAgent, kimiAgent, gooseAgent, poeAgentAgent } from "./agents/index.js";
|
|
2
2
|
function freezeAgent(agent) {
|
|
3
3
|
if (agent.aliases !== undefined) {
|
|
4
4
|
Object.freeze(agent.aliases);
|
|
@@ -6,6 +6,12 @@ function freezeAgent(agent) {
|
|
|
6
6
|
if (agent.apiShapes !== undefined) {
|
|
7
7
|
Object.freeze(agent.apiShapes);
|
|
8
8
|
}
|
|
9
|
+
if (agent.otelCapture?.env !== undefined) {
|
|
10
|
+
Object.freeze(agent.otelCapture.env);
|
|
11
|
+
}
|
|
12
|
+
if (agent.otelCapture !== undefined) {
|
|
13
|
+
Object.freeze(agent.otelCapture);
|
|
14
|
+
}
|
|
9
15
|
Object.freeze(agent.branding.colors);
|
|
10
16
|
Object.freeze(agent.branding);
|
|
11
17
|
return Object.freeze(agent);
|
|
@@ -14,6 +20,7 @@ export const allAgents = Object.freeze([
|
|
|
14
20
|
freezeAgent(claudeCodeAgent),
|
|
15
21
|
freezeAgent(claudeDesktopAgent),
|
|
16
22
|
freezeAgent(codexAgent),
|
|
23
|
+
freezeAgent(cursorAgent),
|
|
17
24
|
freezeAgent(geminiCliAgent),
|
|
18
25
|
freezeAgent(openCodeAgent),
|
|
19
26
|
freezeAgent(kimiAgent),
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { resolveAgentId } from "./registry.js";
|
|
2
|
+
function getOwnModel(specifier) {
|
|
3
|
+
return Object.prototype.hasOwnProperty.call(specifier, "model") ? specifier.model : undefined;
|
|
4
|
+
}
|
|
2
5
|
export function parseAgentSpecifier(input) {
|
|
3
6
|
const colonIndex = input.indexOf(":");
|
|
4
7
|
if (colonIndex === -1) {
|
|
@@ -12,8 +15,9 @@ export function parseAgentSpecifier(input) {
|
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
export function formatAgentSpecifier(specifier) {
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
const model = getOwnModel(specifier);
|
|
19
|
+
if (model) {
|
|
20
|
+
return `${specifier.agent}:${model}`;
|
|
17
21
|
}
|
|
18
22
|
return specifier.agent;
|
|
19
23
|
}
|
|
@@ -22,6 +26,6 @@ export function normalizeAgentId(input) {
|
|
|
22
26
|
const agent = resolveAgentId(specifier.agent) ?? specifier.agent;
|
|
23
27
|
return formatAgentSpecifier({
|
|
24
28
|
agent,
|
|
25
|
-
model: specifier
|
|
29
|
+
model: getOwnModel(specifier)
|
|
26
30
|
});
|
|
27
31
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export type ApiShapeId = "openai-chat-completions" | "openai-responses" | "anthropic-messages" | "google-generations";
|
|
2
|
+
export interface OtelCaptureDefinition {
|
|
3
|
+
env?: Record<string, string>;
|
|
4
|
+
args?: (endpoint: string, content: boolean) => string[];
|
|
5
|
+
}
|
|
2
6
|
export interface AgentDefinition {
|
|
3
7
|
id: string;
|
|
4
8
|
name: string;
|
|
@@ -8,6 +12,7 @@ export interface AgentDefinition {
|
|
|
8
12
|
/** Binary name for CLI agents. Optional for GUI-only apps like Claude Desktop. */
|
|
9
13
|
binaryName?: string;
|
|
10
14
|
readonly apiShapes?: readonly ApiShapeId[];
|
|
15
|
+
readonly otelCapture?: OtelCaptureDefinition;
|
|
11
16
|
configPath: string;
|
|
12
17
|
branding: {
|
|
13
18
|
colors: {
|
|
@@ -19,7 +19,7 @@ export function osascriptProvider(options = {}) {
|
|
|
19
19
|
return parseStdout(stdout);
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
|
-
if (error
|
|
22
|
+
if (hasOwnErrorCode(error, "ENOENT")) {
|
|
23
23
|
throw new Error("osascript not found — provide a different provider on this platform");
|
|
24
24
|
}
|
|
25
25
|
if (isUserCanceled(error)) {
|
|
@@ -31,3 +31,9 @@ export function osascriptProvider(options = {}) {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
+
function hasOwnErrorCode(error, code) {
|
|
35
|
+
return (typeof error === "object" &&
|
|
36
|
+
error !== null &&
|
|
37
|
+
Object.prototype.hasOwnProperty.call(error, "code") &&
|
|
38
|
+
error.code === code);
|
|
39
|
+
}
|
|
@@ -31,6 +31,12 @@ const agentMcpConfigs = {
|
|
|
31
31
|
format: "toml",
|
|
32
32
|
shape: "standard"
|
|
33
33
|
},
|
|
34
|
+
cursor: {
|
|
35
|
+
configFile: "~/.cursor/mcp.json",
|
|
36
|
+
configKey: "mcpServers",
|
|
37
|
+
format: "json",
|
|
38
|
+
shape: "standard"
|
|
39
|
+
},
|
|
34
40
|
opencode: {
|
|
35
41
|
configFile: "~/.config/opencode/opencode.json",
|
|
36
42
|
configKey: "mcp",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasOwnErrorCode(error: unknown, code: string): error is NodeJS.ErrnoException;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
1
2
|
import path from "node:path";
|
|
2
|
-
import { renderTemplate } from "
|
|
3
|
+
import { renderTemplate } from "toolcraft-design";
|
|
3
4
|
import { getConfigFormat, detectFormat } from "../formats/index.js";
|
|
4
5
|
import { cloneConfigObject, setConfigEntry } from "../formats/object.js";
|
|
5
6
|
import { resolvePath } from "./path-utils.js";
|
|
6
7
|
import { isNotFound, readFileIfExists, pathExists, createTimestamp } from "../fs-utils.js";
|
|
8
|
+
import { hasOwnErrorCode } from "../error-codes.js";
|
|
7
9
|
// ============================================================================
|
|
8
10
|
// Helper Functions
|
|
9
11
|
// ============================================================================
|
|
@@ -29,6 +31,7 @@ async function backupInvalidDocument(context, targetPath, content) {
|
|
|
29
31
|
}
|
|
30
32
|
catch (error) {
|
|
31
33
|
if (!isAlreadyExists(error)) {
|
|
34
|
+
await context.fs.unlink(backupPath).catch(() => undefined);
|
|
32
35
|
throw error;
|
|
33
36
|
}
|
|
34
37
|
attempt += 1;
|
|
@@ -36,7 +39,7 @@ async function backupInvalidDocument(context, targetPath, content) {
|
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
41
|
function isAlreadyExists(error) {
|
|
39
|
-
return
|
|
42
|
+
return hasOwnErrorCode(error, "EEXIST");
|
|
40
43
|
}
|
|
41
44
|
async function assertRegularWriteTarget(context, targetPath) {
|
|
42
45
|
// Symlinks inside the managed home directory are untrusted: an attacker could
|
|
@@ -65,30 +68,36 @@ async function assertRegularWriteTarget(context, targetPath) {
|
|
|
65
68
|
}
|
|
66
69
|
async function writeAtomically(context, targetPath, content) {
|
|
67
70
|
await assertRegularWriteTarget(context, targetPath);
|
|
68
|
-
let attempt = 0;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
for (let attempt = 0; attempt < 10; attempt += 1) {
|
|
72
|
+
const tempPath = `${targetPath}.mutation-tmp-${process.pid}-${randomUUID()}`;
|
|
73
|
+
let tempCreated = false;
|
|
71
74
|
try {
|
|
75
|
+
await assertRegularWriteTarget(context, tempPath);
|
|
72
76
|
await context.fs.writeFile(tempPath, content, { encoding: "utf8", flag: "wx" });
|
|
77
|
+
tempCreated = true;
|
|
73
78
|
await context.fs.rename(tempPath, targetPath);
|
|
79
|
+
tempCreated = false;
|
|
74
80
|
return;
|
|
75
81
|
}
|
|
76
82
|
catch (error) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
void cleanupError;
|
|
83
|
+
const alreadyExists = isAlreadyExists(error);
|
|
84
|
+
if (tempCreated || !alreadyExists) {
|
|
85
|
+
try {
|
|
86
|
+
await context.fs.unlink(tempPath);
|
|
87
|
+
}
|
|
88
|
+
catch (cleanupError) {
|
|
89
|
+
if (!isNotFound(cleanupError)) {
|
|
90
|
+
void cleanupError;
|
|
91
|
+
}
|
|
87
92
|
}
|
|
88
93
|
}
|
|
94
|
+
if (alreadyExists) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
89
97
|
throw error;
|
|
90
98
|
}
|
|
91
99
|
}
|
|
100
|
+
throw new Error(`Unable to create temporary mutation file for ${targetPath}.`);
|
|
92
101
|
}
|
|
93
102
|
function describeMutation(kind, targetPath) {
|
|
94
103
|
const displayPath = targetPath ?? "target";
|
|
@@ -392,6 +401,7 @@ async function applyBackup(mutation, context, options) {
|
|
|
392
401
|
}
|
|
393
402
|
catch (error) {
|
|
394
403
|
if (!isAlreadyExists(error)) {
|
|
404
|
+
await context.fs.unlink(backupPath).catch(() => undefined);
|
|
395
405
|
throw error;
|
|
396
406
|
}
|
|
397
407
|
attempt += 1;
|
|
@@ -39,7 +39,7 @@ function merge(base, patch) {
|
|
|
39
39
|
if (value === undefined) {
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
|
-
const existing = result[key];
|
|
42
|
+
const existing = hasConfigEntry(result, key) ? result[key] : undefined;
|
|
43
43
|
if (isConfigObject(existing) && isConfigObject(value)) {
|
|
44
44
|
setConfigEntry(result, key, merge(existing, value));
|
|
45
45
|
continue;
|
|
@@ -23,7 +23,7 @@ function merge(base, patch) {
|
|
|
23
23
|
if (value === undefined) {
|
|
24
24
|
continue;
|
|
25
25
|
}
|
|
26
|
-
const existing = result[key];
|
|
26
|
+
const existing = hasConfigEntry(result, key) ? result[key] : undefined;
|
|
27
27
|
if (isConfigObject(existing) && isConfigObject(value)) {
|
|
28
28
|
setConfigEntry(result, key, merge(existing, value));
|
|
29
29
|
continue;
|
|
@@ -26,7 +26,7 @@ function merge(base, patch) {
|
|
|
26
26
|
if (value === undefined) {
|
|
27
27
|
continue;
|
|
28
28
|
}
|
|
29
|
-
const existing = result[key];
|
|
29
|
+
const existing = hasConfigEntry(result, key) ? result[key] : undefined;
|
|
30
30
|
if (isConfigObject(existing) && isConfigObject(value)) {
|
|
31
31
|
setConfigEntry(result, key, merge(existing, value));
|
|
32
32
|
continue;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
import { hasOwnErrorCode } from "./error-codes.js";
|
|
1
2
|
/**
|
|
2
3
|
* Check if an error is a "file not found" (ENOENT) error.
|
|
3
4
|
*/
|
|
4
5
|
export function isNotFound(error) {
|
|
5
|
-
return (
|
|
6
|
-
error !== null &&
|
|
7
|
-
"code" in error &&
|
|
8
|
-
error.code === "ENOENT");
|
|
6
|
+
return hasOwnErrorCode(error, "ENOENT");
|
|
9
7
|
}
|
|
10
8
|
/**
|
|
11
9
|
* Read a file if it exists, returning null if not found.
|
|
@@ -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
|
}
|
|
@@ -126,6 +126,14 @@ function buildVerifyReport(lookup, opts) {
|
|
|
126
126
|
export async function syncGhProject(opts) {
|
|
127
127
|
const client = resolveGhClient(opts);
|
|
128
128
|
let lookup = await lookupProject(client, opts.owner, opts.number);
|
|
129
|
+
const initialReport = buildVerifyReport(lookup, opts);
|
|
130
|
+
if (initialReport.ok || opts.yes !== true) {
|
|
131
|
+
return {
|
|
132
|
+
...initialReport,
|
|
133
|
+
created: [],
|
|
134
|
+
updated: []
|
|
135
|
+
};
|
|
136
|
+
}
|
|
129
137
|
let resolvedNumber = opts.number;
|
|
130
138
|
const created = [];
|
|
131
139
|
if (lookup.project === null) {
|
|
@@ -320,20 +328,23 @@ function isExactStatusField(field) {
|
|
|
320
328
|
function isStatusOption(value) {
|
|
321
329
|
return (typeof value === "object" &&
|
|
322
330
|
value !== null &&
|
|
323
|
-
"id"
|
|
331
|
+
hasOwnProperty(value, "id") &&
|
|
324
332
|
typeof value.id === "string" &&
|
|
325
|
-
"name"
|
|
333
|
+
hasOwnProperty(value, "name") &&
|
|
326
334
|
typeof value.name === "string" &&
|
|
327
|
-
(!("color"
|
|
328
|
-
(!("description"
|
|
335
|
+
(!hasOwnProperty(value, "color") || typeof value.color === "string") &&
|
|
336
|
+
(!hasOwnProperty(value, "description") || typeof value.description === "string"));
|
|
329
337
|
}
|
|
330
338
|
function isStatusField(value) {
|
|
331
339
|
return (typeof value === "object" &&
|
|
332
340
|
value !== null &&
|
|
333
|
-
"id"
|
|
341
|
+
hasOwnProperty(value, "id") &&
|
|
334
342
|
typeof value.id === "string" &&
|
|
335
|
-
(!("name"
|
|
336
|
-
"options"
|
|
343
|
+
(!hasOwnProperty(value, "name") || typeof value.name === "string") &&
|
|
344
|
+
hasOwnProperty(value, "options") &&
|
|
337
345
|
Array.isArray(value.options) &&
|
|
338
346
|
value.options.every(isStatusOption));
|
|
339
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)) {
|