{"_id":"@arthurhuang09/opencode-preflight","_rev":"3-065e52c418e7dc5ce5d513828bbc61f1","name":"@arthurhuang09/opencode-preflight","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@arthurhuang09/opencode-preflight","version":"0.1.0","keywords":["opencode","plugin","preflight"],"author":{"name":"Arthur Huang"},"license":"MIT","_id":"@arthurhuang09/opencode-preflight@0.1.0","maintainers":[{"name":"arthurhuang09","email":"fanzai.huang@gmail.com"}],"homepage":"https://github.com/arthurhuang09/opencode-preflight#readme","bugs":{"url":"https://github.com/arthurhuang09/opencode-preflight/issues"},"dist":{"shasum":"69011af0e12897a20ad092b22111a8b90afbab27","tarball":"https://registry.npmjs.org/@arthurhuang09/opencode-preflight/-/opencode-preflight-0.1.0.tgz","fileCount":8,"integrity":"sha512-F/t7BtgCsRO43Y8kYiVpX2HViSN/0AiRYjH5y0pJsa9C/UmkyfvKPjZtDKKcBALjsUUUZXipegPhJ1heYShsLw==","signatures":[{"sig":"MEYCIQCqBe65qmwjs0044aRyxrnmUz3OOsxpN+ooUMOtgQ7q0wIhANEYv7inj2zThoLbrkvADEV0H2SMomxiKvCTB/fNez1b","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34394},"main":"src/index.js","type":"module","exports":{".":"./src/index.js","./engine":"./src/engine.js"},"gitHead":"ad9bbb3fb83aeffb3055d54cbe2a1697d0017f7d","scripts":{"lint":"node --check src/*.js test/*.js","test":"node --test","build":"npm pack --dry-run","typecheck":"npm run lint"},"_npmUser":{"name":"arthurhuang09","email":"fanzai.huang@gmail.com"},"repository":{"url":"git+https://github.com/arthurhuang09/opencode-preflight.git","type":"git"},"_npmVersion":"10.8.2","description":"Project-configurable startup preflight prompts for OpenCode.","directories":{},"_nodeVersion":"20.20.1","dependencies":{"@opencode-ai/sdk":"1.14.51","@opencode-ai/plugin":"1.14.51"},"_hasShrinkwrap":false,"peerDependencies":{"@opencode-ai/plugin":">=1.14.0"},"_npmOperationalInternal":{"tmp":"tmp/opencode-preflight_0.1.0_1779016734676_0.2477603879995618","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@arthurhuang09/opencode-preflight","version":"0.1.2","keywords":["opencode","plugin","preflight"],"author":{"name":"Arthur Huang"},"license":"MIT","_id":"@arthurhuang09/opencode-preflight@0.1.2","maintainers":[{"name":"arthurhuang09","email":"fanzai.huang@gmail.com"}],"homepage":"https://github.com/arthurhuang09/opencode-preflight#readme","bugs":{"url":"https://github.com/arthurhuang09/opencode-preflight/issues"},"dist":{"shasum":"c3070de1b1c8877d03f4e71331aaea36ceb2d346","tarball":"https://registry.npmjs.org/@arthurhuang09/opencode-preflight/-/opencode-preflight-0.1.2.tgz","fileCount":8,"integrity":"sha512-eoFo9nqfqVdHe8YkTapStRGK3NMUtmT240PLrftZfSssKyl9qwzU9OiIQBSL+xSI1dhm0YvL7ckRvj4sQzeNfw==","signatures":[{"sig":"MEYCIQCPbKgSOHEHBZJsa/iv+dvDJgCk7q1PZEYZXBekbECm6QIhAIl2Hp/J7Cx9r23ph1FhLosDWjZyVFfnmn99zSwtcXNb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@arthurhuang09%2fopencode-preflight@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":36252},"main":"src/index.js","type":"module","exports":{".":"./src/index.js","./engine":"./src/engine.js"},"gitHead":"e53f3090fc7a4a57606e727eb3f82dd827ec5d0d","scripts":{"lint":"node --check src/*.js test/*.js","test":"node --test","build":"npm pack --dry-run","typecheck":"npm run lint"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:dfad4109-8327-4879-a841-4ee7779d8d2e"}},"repository":{"url":"git+https://github.com/arthurhuang09/opencode-preflight.git","type":"git"},"_npmVersion":"11.14.1","description":"Project-configurable startup preflight prompts for OpenCode.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"@opencode-ai/sdk":"1.14.51","@opencode-ai/plugin":"1.14.51"},"_hasShrinkwrap":false,"peerDependencies":{"@opencode-ai/plugin":">=1.14.0"},"_npmOperationalInternal":{"tmp":"tmp/opencode-preflight_0.1.2_1779018989068_0.9957127775720833","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@arthurhuang09/opencode-preflight","version":"0.1.3","description":"Project-configurable startup preflight prompts for OpenCode.","type":"module","main":"src/index.js","bin":{"opencode-preflight":"src/cli.js"},"exports":{".":"./src/index.js","./engine":"./src/engine.js","./init":"./src/init.js"},"scripts":{"build":"npm pack --dry-run","lint":"node --check src/*.js test/*.js","typecheck":"npm run lint","test":"node --test"},"repository":{"type":"git","url":"git+https://github.com/arthurhuang09/opencode-preflight.git"},"keywords":["opencode","plugin","preflight"],"author":{"name":"Arthur Huang"},"license":"MIT","bugs":{"url":"https://github.com/arthurhuang09/opencode-preflight/issues"},"homepage":"https://github.com/arthurhuang09/opencode-preflight#readme","dependencies":{"@opencode-ai/plugin":"1.14.51","@opencode-ai/sdk":"1.14.51"},"peerDependencies":{"@opencode-ai/plugin":">=1.14.0"},"gitHead":"1feb761253e291ffd5fa6c5ebbcc0baa692aefe3","_id":"@arthurhuang09/opencode-preflight@0.1.3","_nodeVersion":"24.15.0","_npmVersion":"11.14.1","dist":{"integrity":"sha512-QPdA2ghV8l6SE8/PCU95nsH/z1MtBEFPDDuQH0ZMTRKB5B8wspkADgXXFm0cNQanCl8JU3roj+48iQFbX4eIhg==","shasum":"4cd51ca34ba6d751d79fe0a27ee1ca102e919e4d","tarball":"https://registry.npmjs.org/@arthurhuang09/opencode-preflight/-/opencode-preflight-0.1.3.tgz","fileCount":10,"unpackedSize":62097,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@arthurhuang09%2fopencode-preflight@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFS9eKOqlB78qbRTmLRm0p1c96X90sVCuYkq6vzc7RmSAiAcm6WnddyaOjDES5fMJJ+E0ykOE8T0iBfc3E3HrVFZwQ=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:dfad4109-8327-4879-a841-4ee7779d8d2e"}},"directories":{},"maintainers":[{"name":"arthurhuang09","email":"fanzai.huang@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-preflight_0.1.3_1779077577824_0.10727169967747163"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-17T11:18:54.585Z","modified":"2026-05-18T04:12:58.237Z","0.1.0":"2026-05-17T11:18:54.815Z","0.1.2":"2026-05-17T11:56:29.220Z","0.1.3":"2026-05-18T04:12:57.973Z"},"bugs":{"url":"https://github.com/arthurhuang09/opencode-preflight/issues"},"author":{"name":"Arthur Huang"},"license":"MIT","homepage":"https://github.com/arthurhuang09/opencode-preflight#readme","keywords":["opencode","plugin","preflight"],"repository":{"type":"git","url":"git+https://github.com/arthurhuang09/opencode-preflight.git"},"description":"Project-configurable startup preflight prompts for OpenCode.","maintainers":[{"name":"arthurhuang09","email":"fanzai.huang@gmail.com"}],"readme":"# opencode-preflight\n\nOpenCode 的專案可設定啟動前檢查提示。\n\n[English](README.md)\n\n這個套件是 OpenCode plugin 的本地 proof of concept，會根據專案內設定建立 startup prompt。它可以在顯示可執行啟動 action 前，檢查 git 狀態、branch 規則、路徑條件、時間區間、action prompt 檔、JSON memory，以及 action run state。\n\n## 安裝\n\n在目標專案執行 initializer：\n\n```sh\nnpx @arthurhuang09/opencode-preflight init\n```\n\n這會建立 `.opencode/opencode.json`、`.opencode/package.json` 與 `.opencode/plugins/preflight.js`，並在 `.opencode` 內安裝 npm package。它也會註冊 `/preflight-config`、`/preflight-action-list`、`/preflight-action-run` 與 `/preflight-action-edit`。這個 shim-based install 可以避開 OpenCode 對 scoped package 的 npm plugin loader 問題，同時仍使用 npm 上發布的 package。\n\n如果想同時建立預設 preflight action files：\n\n```sh\nnpx @arthurhuang09/opencode-preflight init --with-config\n```\n\n如果只想建立特定 default actions：\n\n```sh\nnpx @arthurhuang09/opencode-preflight init --with-config --actions=project-readiness,task-progress-review\n```\n\n此 repository 的本機開發安裝：\n\n```sh\nnpm install\n```\n\n## 使用方式\n\n1. 在目標專案執行 `npx @arthurhuang09/opencode-preflight init`。\n2. 在該專案啟動 OpenCode。\n3. 從 active session 執行 `/preflight-config`，選擇要建立哪些 default actions，或要求 OpenCode 呼叫 `preflight_config` tool。\n4. 檢查產生的 `.opencode/preflight.jsonc` 與 `.opencode/preflight/*` files。\n5. 在該專案重啟 OpenCode，或開啟新的 OpenCode session。\n\n當設定的 trigger 命中時，plugin 會建立 Startup Preflight session，並詢問要執行哪個已設定 action。標記為 `ask-before-execute` 的 actions 需要 user 確認後才會執行 commands 或編輯 files。\n\n從 active session 可用 `/preflight-action-list` 檢查 matched triggers、configured actions、availability 與 warnings。使用 `/preflight-action-run` 選擇目前 available 的 action；被 run state suppress 的 actions 不會被當成可執行選項。使用 `/preflight-action-edit` 調整單一 action 的行為、prompt file、run state、memory 與 trigger references。\n\n設定 `OPENCODE_PREFLIGHT_AUTOSTART=0` 可以停用自動 startup sessions，同時保留 tool 與 system prompt integration。\n\n## 使用情境\n\n- Default branch 啟動：當 OpenCode 在 `main` 或 `master` 啟動時，詢問是否要整理 issues、檢查專案啟動準備，或暫時略過。\n- Feature branch 接續工作：當 OpenCode 在非 default branch 啟動時，先彙整最近 commits、worktree changes 與可能下一步，再詢問要接著做什麼。\n- 每日或每小時例行檢查：用 time triggers 只在指定時間區間顯示 standup 準備、issue triage 或 dependency checks 等 recurring actions。\n- 專案專屬啟動檢查：要求 `package.json`、`AGENTS.md` 或部署設定等檔案存在時，才提供 startup checklist。\n- Memory-backed follow-up：載入 JSON-file memory topics，讓重複 issue review 可以記住等待 user 回覆、等待外部回覆或可關閉的項目。\n- 降低提示噪音：使用 `runState.skipIfLastRunWithinHours`，避免例行 prompts 在短時間內重複出現。\n\n## 指令\n\n```sh\nnpm run lint\nnpm run typecheck\nnpm test\nnpm run build\nnode --test test/engine.test.js\n```\n\n`lint` 與 `typecheck` 使用 `node --check` 做 JavaScript syntax checks。`build` 執行 `npm pack --dry-run` 來確認 package contents。目前沒有設定 formatter。\n\n## 套件入口\n\n- `src/index.js` 是預設 OpenCode plugin entrypoint。\n- `src/engine.js` 以 `opencode-preflight/engine` 匯出 preflight engine。\n- `src/tui.js` 註冊 `/preflight-config`、`/preflight-action-list` 與 `/preflight-action-run` TUI commands。\n\n## 運作方式\n\nEngine 會讀取作用中專案的 `.opencode/preflight.jsonc`。當 trigger 命中時，它會載入設定的 actions、action prompt files、memory topics，並組出 OpenCode startup prompt。\n\n支援的 trigger 條件包含：\n\n- git 是否可用、是否在 worktree、dirty state，以及 branch rules\n- 必須存在或缺少的專案路徑\n- 可指定 timezone 的日期與時間區間\n\n支援的 action 輸入包含：\n\n- `promptFile` 內容\n- 由 JSON file backing 的 `memory.read` topics\n- 可略過近期已提示 actions 的 `runState` 規則\n\n## 設定專案\n\n使用 plugin tool `preflight_config` 或 `/preflight-config` command 建立預設專案設定檔：\n\n```text\n.opencode/preflight.jsonc\n.opencode/preflight/actions/issue-review.md\n.opencode/preflight/actions/issue-memory.md\n.opencode/preflight/actions/project-readiness.md\n.opencode/preflight/actions/task-progress-review.md\n.opencode/preflight/memory.json\n```\n\n除非傳入 `force: true`，否則 tool 不會覆蓋既有檔案。\n\nDefault action templates 可選：`issue-review`、`project-readiness`、`task-progress-review`。如果沒有提供 action list，會建立全部 default templates。\n\n## 手動安裝\n\n如果不想使用 `npx`，可以自行建立這些檔案。\n\n`.opencode/opencode.json`：\n\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"command\": {\n    \"preflight-config\": {\n      \"description\": \"Create or repair OpenCode preflight config files\",\n      \"template\": \"Ask which default OpenCode preflight actions to create: issue-review, project-readiness, task-progress-review, or all. Then call the preflight_config tool with the selected action ids. Do not overwrite existing files unless I confirm, then list created and skipped files.\"\n    },\n    \"preflight-action-list\": {\n      \"description\": \"List configured preflight actions and current status\",\n      \"template\": \"Call the preflight_action_list tool and summarize the configured OpenCode preflight actions. This is status-only; do not run an action or ask me to choose one.\"\n    },\n    \"preflight-action-run\": {\n      \"description\": \"Choose and run an available preflight action\",\n      \"template\": \"Call the preflight_action_list tool. If no actions are available, explain why and do not ask me to choose one. Otherwise use AskUserQuestion/question with the available action ids and `Do not run anything for now`. After I choose an action, call the preflight_action_prompt tool with that action id, then follow the returned prompt. For ask-before-execute actions, confirm before commands or edits.\"\n    },\n    \"preflight-action-edit\": {\n      \"description\": \"Edit a configured preflight action and its triggers\",\n      \"template\": \"Help me edit one configured OpenCode preflight action. First read `.opencode/preflight.jsonc` and list the configured action ids. Ask which action to edit and what to change: behavior, prompt file, runState, memory, or trigger conditions/references. Then update only the relevant `.opencode/preflight.jsonc` fields and action prompt file. Do not run the action. After editing, summarize the changed files and behavior.\"\n    }\n  }\n}\n```\n\n`.opencode/package.json`：\n\n```json\n{\n  \"type\": \"module\",\n  \"dependencies\": {\n    \"@arthurhuang09/opencode-preflight\": \"latest\"\n  }\n}\n```\n\n`.opencode/plugins/preflight.js`：\n\n```js\nimport preflight from \"@arthurhuang09/opencode-preflight\";\n\nexport default preflight;\n```\n\n接著在 `.opencode` 裡執行 `npm install`。\n\n## TUI Commands\n\n- `/preflight-config` 建立或修復專案內 preflight 設定檔。\n- `/preflight-action-list` 列出 matched triggers、configured actions、run-state availability 與 warnings。\n- `/preflight-action-run` 詢問要執行哪個目前 available 的 action。如果沒有可用 action，會說明原因，不會要求選擇不存在的 action。\n- `/preflight-action-edit` 編輯單一 configured action 的行為、prompt file、run state、memory 與 trigger references，但不執行 action。\n\n## Autostart 行為\n\n設定 `OPENCODE_PREFLIGHT_AUTOSTART=0`，或 OpenCode 以 `-s`、`--session`、`--session=...` 啟動時，會跳過 autostart。\n\nStartup prompt injection 使用 OpenCode SDK v2 transport，也就是 `client._client`；如果 transport 不存在，injection 會維持 no-op。\n\n## 測試\n\n測試使用 `node:test`，並建立隔離的暫存專案與 `.opencode/preflight` fixtures。`buildPreflight()` 預設會記錄 run state，因此需要可重複 prompt 的測試應傳入 `{ recordRunState: false }`，或使用新的暫存專案。\n","readmeFilename":"README.zh-TW.md"}