@joripspace/cli 0.5.8 → 0.6.1

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.
@@ -1,4 +1,4 @@
1
- const { JORIPSPACE_CLI_GUIDE, JORIPSPACE_NPM_ONBOARDING_DOCUMENT } = require('./cli-onboarding.cjs');
1
+ const { JORIPSPACE_TOOL_SELECTION_LINES, JORIPSPACE_CLI_GUIDE, JORIPSPACE_NPM_ONBOARDING_DOCUMENT } = require('./cli-onboarding.cjs');
2
2
  const { buildGithubWorkflow, projectGithubActionsTemplateFile } = require('./github-workflow.cjs');
3
3
  const { templateGithubActionsPublishFile } = require('./template-publish-workflow.cjs');
4
4
 
@@ -15,14 +15,14 @@ const JORIPSPACE_ONBOARDING_GITIGNORE_ENTRIES = [
15
15
  '.joripspace/local-backups/',
16
16
  ];
17
17
  const JORIPSPACE_ONBOARDING_GITIGNORE_REMOVALS = ['.joripspace/agent-session.json'];
18
- const JORIPSPACE_AGENT_GUIDE_UPDATED_AT = '2026-09-07T14:00:27+09:00';
18
+ const JORIPSPACE_AGENT_GUIDE_UPDATED_AT = '2026-10-24T22:35:07+09:00';
19
19
  const JORIPSPACE_WORKFLOW_POLICY = Object.freeze({
20
20
  target: 'joripspace',
21
21
  guide_required: true,
22
22
  external_hosting_deployment: 'blocked',
23
23
  generic_scaffold_recovery: 'convert_to_joripspace',
24
- framework_selection: 'agent_managed_dynamic_worker_or_hono',
25
- framework_reassessment: 'migrate_pure_worker_to_hono_as_scope_grows',
24
+ framework_selection: 'hono_default_for_new_projects',
25
+ framework_reassessment: 'preserve_existing_framework',
26
26
  rendering_default: 'server_side_all_user_facing_routes',
27
27
  user_interaction: 'automatic_unless_business_or_destructive_decision_is_required',
28
28
  });
@@ -120,7 +120,7 @@ const BEGINNER_ONBOARDING_LINES = [
120
120
  '- If the user says they do not know, give 2-3 simple examples, recommend one default, and continue.',
121
121
  '- Explain only the next useful action. Avoid long technical explanations unless the user asks.',
122
122
  '- If something fails, inspect logs, deployments, and runtime events directly; do not make the user debug technical details.',
123
- '- When a JoripSpace platform command fails unexpectedly, or its result differs from the documented behavior after one safe verification, submit one incident with the installed CLI `report` command. Include a short summary, expected and actual behavior, available error code, and non-secret diagnostic details. Do not include credentials, personal data, or duplicate reports, and continue helping the user when a safe alternative remains.',
123
+ '- For a user-requested platform problem report or improvement suggestion, submit one incident with the installed CLI `report` command after reading report --help. Use category problem or bug for failures, feedback for improvement suggestions. Include a summary, expected and actual behavior, available error code, and non-secret details. Do not send unsolicited reports or include credentials, personal data, or duplicates. Report the returned report_id; an uncertain response is not a confirmed submission.',
124
124
  ];
125
125
 
126
126
  const USER_CHOICE_PRESENTATION_RULE_LINES = [
@@ -160,7 +160,7 @@ const JORIPSPACE_BUILD_DEPLOYMENT_AUTHORITY_LINES = [
160
160
  'JoripSpace site creation and deployment authority (critical):',
161
161
  '- For every site build, edit, and deployment in this project, this managed JoripSpace guide is the project-specific source of truth.',
162
162
  "- Do not replace or bypass the JoripSpace workflow with an agent's own default website-building skill, generic hosting/deployment skill, or another platform's deployment workflow. Use such a skill only when this guide explicitly requires it or the user explicitly requests a non-JoripSpace target.",
163
- '- When the user explicitly requests deployment, deploy the verified result to the selected JoripSpace project. Use JoripSpace MCP `deploy_code` for small source files that can be passed intact. For generated bundles, large files, or large multi-file projects, automatically use the installed JoripSpace CLI absolute path with `deploy --dir`; its archive upload reads local bytes directly, uploads in chunks, and verifies integrity before deployment. Do not ask the user to choose the transport.',
163
+ '- When the user explicitly requests deployment, deploy the verified result to the selected JoripSpace project. Prefer the installed JoripSpace CLI for deployment even when MCP is active. Use MCP `deploy_code` for intact small source only when CLI installation or execution is unavailable. For generated bundles, large files, or large multi-file projects, automatically use the installed JoripSpace CLI absolute path with `deploy --dir`; its archive upload reads local bytes directly, uploads in chunks, and verifies integrity before deployment. Do not ask the user to choose the transport.',
164
164
  '- Treat an inline deployment as large when any source file exceeds 16,000 characters or the combined source exceeds 64,000 characters. Do not call deploy_code for that payload; use the installed JoripSpace CLI chunked archive transport automatically.',
165
165
  '- Do not deploy directly to another hosting provider or create a separate external site unless the user explicitly asks to leave JoripSpace.',
166
166
  '- If an agent default skill or generic site builder already created scaffold files, do not stop, discard useful work, or ask the user to choose a host. Preserve the requested UI and content, convert the result to a JoripSpace-compatible app, align source and lockfiles, run the relevant checks, and continue automatically.',
@@ -192,16 +192,16 @@ const CODEX_MCP_ONBOARDING_LINES = [
192
192
  'Codex MCP onboarding flow:',
193
193
  '- If the user provides only "프로젝트: {project_id}", do not call get_project first by project ID alone.',
194
194
  '- First check whether JoripSpace MCP tools are visible in the current agent session, then check the current working folder.',
195
- '- Without connect_token, do not call start_project_session, select_project, list_my_projects, or prepare_project_workspace.',
195
+ '- Without an authenticated MCP transport session, do not call project tools. Authenticate through the client OAuth flow or exchange a connection code in the initialized MCP session; never ask the user for an API token.',
196
196
  '- Never use an empty string, dummy value, environment bearer token, browser cookie, localStorage value, profile page value, or settings file value as a connect_token.',
197
- '- If no connection token is available, call start_login or browser_connect and show the returned connect_url. Ask the user to approve the connection in a logged-in browser and paste only the displayed MCP/CLI connection token back into chat.',
198
- '- After connection approval succeeds, reuse the returned account API token for project tools and write the returned workspace connection files. The user should never have to find, name, or enter JORIPSPACE_API_TOKEN manually.',
197
+ '- If the MCP transport session is not authenticated, call start_login or browser_connect and show the returned connect_url. Ask the user to approve the connection in a logged-in browser and paste only the displayed 5-minute one-time connection code back into chat. Immediately call exchange_connection_code with that code; never pass the code as connect_token.',
198
+ '- After exchange_connection_code succeeds, call start_project_session with project_id in the same MCP transport session without token arguments. The server resolves the credential internally. Write only the returned nonsecret workspace metadata and preserve existing local credentials. The user should never have to find, name, or enter JORIPSPACE_API_TOKEN manually.',
199
199
  '- Do not ask for email, password, Google app password, SMTP password, personal API key, or payment key in chat.',
200
200
  '- If deploy_code, deploy_checkpoint, or rollback_deployment returns deployment_state_unknown, call list_deployments before any retry. If a new successful deployment exists, verify it and do not redeploy. Otherwise retry the same deployment tool at most once.',
201
201
  '- Do not restart the connection flow for a deployment timeout. Restart connection only for connection_required, invalid_token, or another explicit authentication error.',
202
202
  '- Create local files only after MCP session connection succeeds and workspace_setup.files or local_file_operations are returned.',
203
203
  '- Before writing files, verify the current working folder. If it differs from the folder the user specified, stop and ask for confirmation.',
204
- '- After receiving connect_token, call start_project_session(connect_token, project_id) immediately. Follow source_sync before writing workspace_setup.files when the session reports github_repository_sync_required; otherwise write returned workspace files normally. Do not initialize Git merely for JoripSpace onboarding.',
204
+ '- After session authentication succeeds, call start_project_session(project_id) immediately without copying credentials into arguments or local files. Follow source_sync before writing workspace_setup.files when the session reports github_repository_sync_required; otherwise write returned workspace files normally. Do not initialize Git merely for JoripSpace onboarding.',
205
205
  '- If start_project_session reports github_repository_sync_required, treat the connected GitHub repository and branch as the source of truth. Using the current user GitHub credentials, clone into an empty current folder or safely fetch and fast-forward the matching clean repository, then write the connection workspace files. Never restore a JoripSpace deployment artifact over a GitHub-connected source workspace, never force-push or hard-reset, and stop with the concrete Git/auth conflict when safe synchronization is impossible.',
206
206
  '- If start_project_session reports latest_deployment_sync_required, do not ask whether to restore and do not offer rollback versions. Write the connection workspace files first, call get_deployment_source with deployment_restore.latest_artifact.deployment_id, back up conflicting local files, and apply the returned local_file_operations before asking questions or editing the project.',
207
207
  '- For a completely new project, start_project_session embeds the current published templates in onboarding.template_choice.templates. After workspace files are ready, use that embedded list before the first service question. Do not depend on a newly added or separately cached list_templates tool during initial onboarding.',
@@ -220,38 +220,38 @@ const CODEX_MCP_ONBOARDING_LINES = [
220
220
  ];
221
221
 
222
222
  const CODEX_MCP_USER_CONNECT_MESSAGE_LINES = [
223
- 'JoripSpace 프로젝트를 Codex에 연결하려면 먼저 연결 토큰이 필요합니다.',
223
+ 'JoripSpace 프로젝트를 Codex에 연결하려면 먼저 5분짜리 일회용 연결 코드가 필요합니다.',
224
224
  '1. 브라우저에서 아래 링크를 엽니다.',
225
225
  '2. JoripSpace에 로그인된 상태에서 연결을 승인합니다.',
226
- '3. 화면에 표시되는 MCP/CLI 전용 연결 토큰을 이 채팅에 붙여넣습니다.',
227
- '주의: 이메일이나 비밀번호는 필요하지 않습니다. Google 앱 비밀번호나 SMTP 비밀번호를 채팅에 붙여넣지 마세요. Codex가 브라우저 쿠키나 저장소에서 토큰을 직접 찾으면 안 됩니다. 연결 토큰은 프로젝트 온보딩 세션을 시작하기 위한 값이며, 일반 API bearer token과 다릅니다.',
226
+ '3. 화면에 표시되는 MCP/CLI 전용 연결 코드를 이 채팅에 붙여넣습니다. Codex는 이 코드를 exchange_connection_code로 교환한 뒤 받은 연결 토큰으로 프로젝트 세션을 시작합니다.',
227
+ '주의: 이메일이나 비밀번호는 필요하지 않습니다. Google 앱 비밀번호나 SMTP 비밀번호를 채팅에 붙여넣지 마세요. Codex가 브라우저 쿠키나 저장소에서 토큰을 직접 찾으면 안 됩니다. 연결 코드는 연결 토큰이 아니며 한 번만 사용할 수 있습니다. 교환 후 발급되는 연결 토큰은 프로젝트 온보딩 세션을 시작하기 위한 값이며, 일반 API bearer token과 다릅니다.',
228
228
  ];
229
229
 
230
230
  const SECRET_RULE_LINES = [
231
231
  'Secret and token rules:',
232
- '- When the user says a Secret or key needs to be generated, entered, added, or registered, do not stop by asking them to determine the key name or purpose. Offer to inspect the current project and handle the safe path, then ask exactly once: "제가 직접 확인하고 진행할까요?" Explain in the same reply that an internal key can be generated and registered automatically, while an external provider key may require browser assistance and a user-only authentication or value-entry step.',
233
- '- After the user approves with a clear reply such as "네", "진행해", "너가 해", or "ㅇㅇ", inspect the project source, configuration, current task, and safe metadata to infer the required binding name, purpose, and whether it is internal or externally issued. Ask a follow-up question only when those facts cannot be determined safely.',
234
- '- The initial Secret-work consent covers the described inspection and resulting internal generation or external browser-assisted registration. Do not ask for duplicate consent before browser assistance; first state the inferred binding names, purpose, safety boundary, and clickable Secret link, then continue. Ask new consent only if the scope materially changes.',
232
+ '- When the user asks to generate or register a Secret, do not stop by asking them to determine the key name or purpose. Inspect the project and safe metadata, infer the binding and internal-versus-external purpose, and carry out the authorized task. Internal generation does not need duplicate consent or browser registration.',
233
+ '- Ask a follow-up only when the binding, purpose, target project, or replacement scope cannot be determined safely. Do not rotate unrelated existing keys or change provider accounts as part of internal generation.',
234
+ '- Do not ask for duplicate consent before browser assistance already authorized for the described credential task. Ask new consent only if browser assistance was not authorized or the scope materially changes.',
235
235
  '- Never put API keys, payment keys, SMS/email keys, database URLs, or tokens in source code, README files, browser JavaScript, screenshots, chat summaries, logs, error messages, or audit metadata.',
236
236
  '- Store external service keys used by deployed code only as JoripSpace project secrets. Only the selected project User Worker secret binding stores the value; the platform DB keeps project-scoped name, status, and lifecycle timestamps only.',
237
237
  '- Never copy project Secret values into source code, env.DB, env.STORAGE, deployment source, checkpoint files, saved copies, logs, error messages, or audit metadata.',
238
- '- Do not ask the user to paste provider Secret values into chat. Send them to the "비밀 키" tab for the selected project to register, replace, or delete the value, then use list_secrets only to confirm name, status, and timestamps. Secret values never appear in list responses or agent reports.',
238
+ '- Do not ask the user to paste provider Secret values into chat. Prefer CLI secret set --name NAME --value-stdin for an authorized external value supplied through safe process input; otherwise send them to the selected project Secret web page for user-only entry. Deletion remains a web operation. Verify metadata with CLI secret list or MCP list_secrets. Secret values never appear in list responses or agent reports.',
239
239
  '- Every user-facing request for an external provider credential must include a clickable Markdown link to `https://joripspace.com/projects/{project_id}/?tab=secrets`. Use the selected project slug in place of `{project_id}`. Never mention only the tab name or provide an unlinked URL.',
240
- '- Before browser assistance for an external provider credential, explain the exact required binding names, what each key enables, and that Secret values must not be pasted into chat. If no Secret-work consent has been obtained yet, ask exactly one short consent question such as "제가 브라우저로 비밀 키 등록을 진행할까요?". If the user already approved "제가 직접 확인하고 진행할까요?", do not ask again.',
240
+ '- Before browser assistance for an external provider credential, explain the exact required binding names, purpose, and chat safety rule. If browser assistance was not already authorized, ask once "제가 브라우저로 비밀 키 등록을 진행할까요?". Do not ask again for already authorized assistance.',
241
241
  '- Treat clear affirmative replies such as "네", "진행해", "너가 해", or "ㅇㅇ" as approval for that described browser-assisted credential task only. Approval does not authorize unrelated account changes, credential rotation, billing changes, or destructive actions.',
242
242
  "- After approval, use an available browser-control tool with the user's existing signed-in session to open the provider and selected JoripSpace project Secret pages and complete safe navigation and form steps. Never inspect cookies, localStorage, sessionStorage, saved passwords, or unrelated account pages.",
243
243
  '- Keep provider Secret values out of chat, screenshots, shell commands, clipboard history, local files, tool summaries, and logs. If the browser environment cannot transfer a value without exposing it, or if reauthentication, MFA, CAPTCHA, credential reveal, or other user-only verification is required, stop at that exact visible step and ask the user to complete only that step in the browser. Continue automatically after the user confirms completion.',
244
244
  '- After browser-assisted registration, call list_secrets and report only the binding name and registration status. Never repeat, reveal, compare, or summarize the Secret value.',
245
- '- Store local connection secrets only in ignored files such as `.env.joripspace`. Store the JoripSpace API token only in `.env.joripspace`, never duplicate its value in JSON, TOML, source, another session file, or MCP client configuration. The shared project identity is the one-line `.joripspace/project` slug.',
246
- '- If an MCP/CLI connect_token or api_token is missing, do not browse around, inspect cookies, read browser storage, or try profile pages to discover it. Ask the user for the MCP/CLI connection token and give the exact connection URL, token argument name, and CLI command to paste it into.',
245
+ '- Prefer the OS credential store for local JoripSpace CLI tokens. If it is unavailable before writing, login uses the ignored project-local `.env.joripspace`; logout removes that saved token. Never duplicate the value in JSON, TOML, source, another session file, or MCP client configuration. The shared project identity is the one-line `.joripspace/project` slug.',
246
+ '- If an MCP/CLI connect_token or api_token is missing, do not browse around or inspect browser storage to discover it. Show the connection URL and ask only for the displayed 5-minute one-time code. Use CLI login --code or MCP exchange_connection_code, then use the MCP session server-side or let CLI login persist its own local credential without printing it. Never request the token itself or pass the code as connect_token.',
247
247
  '- Secret names must match [_A-Z][_A-Z0-9]* and be at most 128 characters. DB, STORAGE, PROJECT_ID and names beginning JORIPSPACE_, CF_, or CLOUDFLARE_ are reserved and must not be used.',
248
248
  '- A project supports at most 60 active secrets, and each value must be 1-5,120 UTF-8 bytes. Use clear uppercase names such as TOSS_PAYMENTS_SECRET_KEY, TOSS_PAYMENTS_BILLING_SECRET_KEY, DODO_PAYMENTS_API_KEY, SOLAPI_API_KEY, or SOLAPI_API_SECRET.',
249
- '- For app-internal random values such as session signing, CSRF protection, encryption, or test secrets, call generate_project_secret. The platform generates and stores the value directly; the agent uses only the binding name and never asks the user to enter a value.',
250
- '- The project_agent connection is authorized for value-blind internal Secret generation through project.secrets.generate. It is not authorized to set, replace, read, or delete external provider Secret values.',
249
+ '- For app-internal random values such as session signing, CSRF protection, encryption, or test secrets, prefer CLI secret generate --name NAME --json; use generate_project_secret when the CLI cannot run. Both generate and store the value without exposing it and preserve an existing active binding. Do not ask the user to enter a random value.',
250
+ '- The project_agent connection is authorized for value-blind internal Secret generation through project.secrets.generate and CLI registration/replacement through project.secrets.set using standard input. Stored Secret values cannot be read back, and Secret deletion remains a web operation. Do not pass values through MCP tool arguments or chat.',
251
251
  '- If generate_project_secret or another Secret registration API fails because of permission, authorization, access, or write restrictions, do not end with manual registration instructions. Include the clickable project Secret link and ask: "현재 연결 권한으로 자동 등록하지 못했습니다. 제가 브라우저로 직접 진행할까요?".',
252
252
  '- On that fallback question, do not ask the user to invent or enter a random value yet. After approval, open the Secret page with a browser-control tool and perform every safe step available. Ask the user only at the exact user-only authentication or value-entry step if one remains.',
253
253
  '- Treat the API failure as a change of execution path, not completion. Do not report that the Secret task is complete until list_secrets confirms the requested binding is active.',
254
- '- Internal random Secret generation does not require browser assistance. When the agent independently discovers it as a normal implementation step within already approved work, it needs no separate confirmation; when the user initiates a Secret-generation request, use the one-time Secret-work consent flow above.',
254
+ '- Internal random Secret generation does not require browser assistance or an extra approval when the user requests generation or it is necessary for already authorized implementation. Verify the active binding through secret list or list_secrets before reporting completion.',
255
255
  '- Secrets are isolated by the immutable internal project id. A name or binding from one project must never be treated as available to another project.',
256
256
  '- Normal project deployments and rollbacks preserve secret_text and secret_key bindings. Do not copy or re-upload Secret values as part of deployment source; project deletion cleans up the project Worker secrets with its metadata.',
257
257
  '- Browser code may receive only public keys or safe redirect URLs. Server routes must handle private provider calls.',
@@ -291,6 +291,7 @@ const PROJECT_CAPABILITY_LINES = [
291
291
  '- Before completion and again before deployment, verify every route in the route inventory with available automated tests and HTTP requests: each path responds correctly, URL-based routing is implemented, and an unknown path returns a friendly not-found response. Use an interactive browser only when the user explicitly asks for browser or visual verification. If any check fails, fix it and do not deploy.',
292
292
  '- DB: app code can use env.DB for structured records. For schema changes or data cleanup, use MCP describe_db, query_db, and run_db_migration, or the CLI db commands. A public app route such as /migrate is not the normal path because DB management tools already exist.',
293
293
  '- DB-backed features should consider the full operating loop by default: create, list with pagination, view detail, update, delete/archive, validation, empty states, and safe admin controls unless the user explicitly scopes them out.',
294
+ '- Database point-in-time restore is an owner-only, high-risk action in the JoripSpace web Backup and restore tab. It saves the current point first and validates foreign keys and integrity after restoring. Do not attempt it through project-agent MCP or CLI tools.',
294
295
  '- Storage: app code can use env.STORAGE for uploads, generated files, and private downloads. For agent-side file checks or one-off file operations, use MCP storage tools or CLI storage commands.',
295
296
  '- Public cache: JoripSpace safely bypasses Workers Cache unless a GET or HEAD response explicitly sets Cache-Control: public with a positive max-age or s-maxage. Use that only for public, reusable files or responses. Keep authenticated, personalized, private, or mutable responses on Cache-Control: private, no-store.',
296
297
  '- Realtime: when the user asks to implement realtime chat, use /_joripspace/realtime?room=main and the platform-managed SQLite history/search flow by default. JoripSpace stores accepted message history, preserves room ordering, maintains FTS5 search, and records project usage automatically without asking the user to choose Cloudflare, Durable Object, or FTS5.',
@@ -301,7 +302,7 @@ const PROJECT_CAPABILITY_LINES = [
301
302
  '- Realtime history: read a room page from /_joripspace/realtime/rooms/{room}/messages?limit=50&before={cursor}. Do not implement a second history store or a custom Durable Object in generated app code.',
302
303
  '- Realtime search: search the same room endpoint with search={query}, limit, and before. Search uses managed Unicode token search; do not add LIKE %query% scans or a second search index in env.DB.',
303
304
  '- Realtime usage: duplicate message ids and retried usage event ids are idempotent. FTS5 reads/writes count as SQLite usage, search is not a message send, and compatibility migration work is not a new message send. All usage is attributed to the resolved immutable internal project id.',
304
- '- Project mail: when the user asks to connect email sending, use MCP connect_mail. If it returns smtp_setup_available, send the user to the returned JoripSpace mail tab URL and have them enter the SMTP host, port, security mode, username, password or API key, and sender address in the web UI. Never ask them to paste SMTP credentials into chat. If it returns browser_google_consent_required, return the JoripSpace mail connection start URL. Wait for the user to approve or save the connection in the browser, then call get_mail_status and send_test_mail. Do not modify project source or implement a separate mail integration.',
305
+ '- Project mail: when the user asks to connect email sending, prefer CLI mail connect; use MCP connect_mail when the CLI cannot run. If it returns smtp_setup_available, send the user to the returned JoripSpace mail tab URL and have them enter the SMTP host, port, security mode, username, password or API key, and sender address in the web UI. Never ask them to paste SMTP credentials into chat. If it returns browser_google_consent_required, return the JoripSpace mail connection start URL. Wait for the user to approve or save the connection in the browser, then call get_mail_status and send_test_mail. Do not modify project source or implement a separate mail integration.',
305
306
  '- Explain these to ordinary users as 서버, DB, 스토리지, and 실시간. Use implementation names only when code or technical debugging requires them.',
306
307
  ];
307
308
 
@@ -359,14 +360,12 @@ const IMAGE_AND_FILE_PLACEMENT_LINES = [
359
360
 
360
361
  const FRAMEWORK_SELECTION_LINES = [
361
362
  'Framework selection rules (agent decides internally):',
362
- '- Keep the current technology stack for an existing project unless there is a concrete reason to change it.',
363
- '- Use a pure Cloudflare Worker for a new, single-purpose feature with only simple request handling and no meaningful shared middleware.',
364
- '- Use Hono when the service has multiple APIs or routes, or needs shared authentication, CORS, validation, error handling, middleware, or similar cross-cutting behavior.',
365
- '- If routing would otherwise grow into a hand-written if/switch dispatch structure, use Hono instead.',
366
- '- If the choice between a pure Worker and Hono is ambiguous, choose Hono.',
367
- '- When Hono is selected for a new project, use the current stable release compatible with the project. Do not downgrade Hono merely because a bundled entrypoint uses `export { app as default }`; JoripSpace accepts valid ES module default export forms.',
368
- '- Re-evaluate this choice as the service grows. If a pure Worker later reaches the Hono conditions above, migrate it to Hono during the task without asking the user to choose a framework.',
369
- '- During a pure Worker to Hono migration, preserve existing URLs, request/response behavior, bindings, and user data; update dependencies and the lockfile together; then rerun relevant checks before continuing.',
363
+ '- Keep the current technology stack for an existing project. Do not migrate an existing project to Hono solely because Hono is the default for new projects.',
364
+ '- Use Hono as the default server framework for every new project, including single-route and simple services.',
365
+ '- Use Hono routes and middleware for shared authentication, CORS, validation, error handling, and similar cross-cutting behavior in new projects.',
366
+ '- For new projects, use Hono routing instead of a hand-written if/switch dispatch structure.',
367
+ '- For a new Hono project, use the current stable release compatible with the project. Do not downgrade Hono merely because a bundled entrypoint uses `export { app as default }`; JoripSpace accepts valid ES module default export forms.',
368
+ '- When the user requests a framework migration, preserve existing URLs, request/response behavior, bindings, and user data; update dependencies and the lockfile together; then rerun relevant checks before continuing.',
370
369
  '- A short, single-purpose service may keep its implementation in one Worker entry file.',
371
370
  '- As routes, authentication, validation, data access, external integrations, admin features, or unrelated responsibilities grow, split the source into role-based modules such as routes, middleware, services, repositories, and utilities.',
372
371
  '- Keep the Worker entrypoint focused on application setup and route wiring. Do not combine all implementation into worker.js merely to reduce the source file count.',
@@ -404,9 +403,9 @@ const FRAMEWORK_DEPLOYMENT_PRIORITY_LINES = [
404
403
 
405
404
  const AGENT_OPERATING_RULE_LINES = [
406
405
  '- Public pricing page copy is product-approved content. Do not rename, paraphrase, reorder, or otherwise improve plan names, subtitles, benefits, prices, units, descriptions, or CTA text unless the user explicitly requests that exact change. When a pricing copy change is requested, update SSR, browser rendering, documentation, and release checks together.',
407
- '- JoripSpace execution order: use MCP tools when they are active. Otherwise continue with the installed JoripSpace CLI absolute path returned by `start`. For generated bundles, large files, or large multi-file projects, use that CLI path even when MCP tools are visible because it uploads local bytes in verified chunks.',
406
+ '- JoripSpace execution order: prefer the installed CLI, or install/update it when the environment supports it, even when MCP tools are active. Use onboarding.invocation from CLI start. Use MCP only when CLI installation or execution is unavailable; do not move credentials between configurations.',
408
407
  '- MCP-only setup and deploy do not require Node.js or Git. Follow the local tool readiness rules: check and report both tools during onboarding, but install only a missing tool that the current project path actually requires and only after explicit user approval. Never ask the beginner to run npm or git commands.',
409
- '- If a required MCP/CLI token is missing, stop setup and give precise recovery instructions instead of browsing around: open https://joripspace.com/connect/ in a logged-in browser, approve the connection, copy the displayed 5-minute connection code, then provide it as connect_token or run `joripspace login --code "복사한_연결_코드"`.',
408
+ '- If a required MCP/CLI token is missing, stop setup and give precise recovery instructions instead of browsing around: open https://joripspace.com/connect/ in a logged-in browser, approve the connection, copy the displayed 5-minute connection code, then exchange it with exchange_connection_code (never pass the code as connect_token) or run `joripspace login --code "복사한_연결_코드"`.',
410
409
  '- A verified pre-existing package helper is conditional legacy compatibility only. New `start` onboarding does not generate it. Never prefer it over the installed JoripSpace CLI or install Node.js solely to run a JoripSpace helper.',
411
410
  '- Use the installed CLI for checkpoint, restore, pull, and archive deployment when MCP is unavailable or inline transport is unsuitable. Node.js readiness is determined only by the project build itself or an explicitly requested legacy helper workflow.',
412
411
  '- When MCP is unavailable, use the installed JoripSpace CLI absolute path returned by start. Use its `deploy --dir` command for generated bundles, large files, or large multi-file projects. Do not require an app restart, project-local helper, or Node.js installation, and do not ask the user to choose or run the command.',
@@ -415,14 +414,14 @@ const AGENT_OPERATING_RULE_LINES = [
415
414
  '- During initial MCP onboarding, if a successful downloadable deployment exists, automatically use the latest successful deployment as the local workspace baseline before starting work. Do not ask whether to restore and do not offer older rollback versions.',
416
415
  '- Restore the latest deployed source into the current local workspace after backing up conflicting local files outside the project folder. Never overwrite `.env.joripspace`, `.joripspace/project`, AGENTS.md, CLAUDE.md, agent configuration, or any token file during deployed-source restore.',
417
416
  '- When speaking to the user, use simple product terms: say server, DB, storage, and realtime. Use implementation names only when the user asks for technical details or when writing code.',
418
- '- Read the canonical one-line `.joripspace/project` and source-bound `.env.joripspace` connection before deploying or operating the project. Authentication values and per-collaborator guide-check time live only in `.env.joripspace`.',
417
+ '- Read the canonical one-line `.joripspace/project` before deploying or operating the project. Let the CLI resolve local credentials internally, or let the MCP transport resolve its session server-side; do not read credential files into agent context. CLI authentication lives in its OS credential store or supported ignored local fallback; MCP authentication remains in its transport session. Workspace responses include only nonsecret connection metadata and guide-check time.',
419
418
  '- A JoripSpace project should already have its server, DB, and storage prepared at project creation. Do not ask the user to choose or configure DB/storage bindings.',
420
419
  '- Use MCP/CLI DB tools to inspect schema, run migrations, and query project data when the service needs stored records.',
421
420
  '- Use MCP/CLI storage tools to list, read, write, and delete project files when the service needs uploads or generated files.',
422
421
  '- Keep secrets out of git. Add provider keys through project secrets or ignored local files only.',
423
422
  '- If dependencies are missing, detect the package manager and install what is needed yourself when it is safe. Ask the user only for paid accounts, credentials, or business decisions.',
424
423
  '- Git is optional for ordinary JoripSpace MCP onboarding and direct MCP deployment, but required for a connected GitHub source or deployment route. If required and missing, use the shared readiness approval flow; otherwise continue without Git and do not ask the beginner to initialize, commit, fetch, or push.',
425
- '- If Git is available, initialize the current project folder during onboarding when it is not already a repository. Preserve an existing repository and its history. Never initialize a parent folder or another unrelated folder.',
424
+ '- Do not initialize Git merely for onboarding. Initialize it only when the selected Git-history template or connected GitHub route requires it. Preserve an existing repository and its history. Never initialize a parent folder or another unrelated folder.',
426
425
  '- Before staging a deployment commit, inspect git status and the staged diff, and exclude secrets, tokens, local credential files, dependencies, build caches, and unrelated user changes. `.joripspace/project` may be committed because it contains only the canonical slug. Never use git add -A blindly in a dirty workspace.',
427
426
  '- Build the smallest usable version first, then improve it after testing.',
428
427
  '- Deploy only when the user explicitly requests deployment of the current change. Otherwise run checks and save a checkpoint without deploying.',
@@ -460,21 +459,22 @@ const CHECKPOINT_AGENT_RULE_LINES = [
460
459
  '- Treat local file restore and production rollback as separate confirmed actions. 이전 상태로 돌아가 means explain and confirm both independently.',
461
460
  '- Whenever two or more restore points or rollback versions are shown, including in response to an availability or inventory question such as "복원 가능한 것들이 있나?", show them as a Markdown table with number, version or identifier, timestamp, label or status, and effect. Do not wait until the user explicitly asks to choose one.',
462
461
  '- Customer project secrets, .env files, certificates, and private keys may be included in checkpoints and deployments with redacted warnings; never print their values or file contents. Continue excluding JoripSpace connection credentials, .git, node_modules, .wrangler, agent instructions/configuration, and `.joripspace/project`. Preserve the local canonical marker during restore.',
463
- '- Prefer MCP checkpoint tools. If MCP is unavailable, use the installed JoripSpace CLI absolute path with checkpoint save, checkpoint list, checkpoint restore, and checkpoint deploy. Existing npm run joripspace:* helpers are conditional legacy compatibility only and are never required by new start onboarding.',
462
+ '- Prefer the installed JoripSpace CLI for checkpoint save, checkpoint list, checkpoint restore, and checkpoint deploy even when MCP is active. Use MCP checkpoint tools when the CLI cannot be installed or executed. Existing npm run joripspace:* helpers are conditional legacy compatibility only and are never required by new start onboarding.',
464
463
  ];
465
464
 
466
465
  const AFTER_CONNECTION_RULE_LINES = [
467
466
  'After MCP or CLI setup:',
468
- "- At the start of each new distinct user task, call search_knowledge once with the user's plain request before answering, planning, asking questions, or starting work. Apply the returned user_guidance, recommendation, and actions to both the response and the work, including short user requests. Do not repeat the search for every follow-up in the same task unless the topic changes or current guidance is needed.",
467
+ ...JORIPSPACE_TOOL_SELECTION_LINES,
468
+ "- At the start of each new distinct user task, use CLI knowledge search when available; in the MCP fallback, call search_knowledge once with the user's plain request before answering, planning, asking questions, or starting work. Apply the returned user_guidance, recommendation, and actions to both the response and the work, including short user requests. Do not repeat the search for every follow-up in the same task unless the topic changes or current guidance is needed.",
469
469
  '- If search_knowledge returns no direct match, use its prioritized fallback guidance and ask at most three short business questions. If the knowledge service fails, continue with the built-in JoripSpace guide and explain only when the failure blocks the task.',
470
470
  '- Do not stop with only "yes, it is possible" or a capability checklist.',
471
- '- If setup cannot continue because connect_token or api_token is missing, do not click through the browser, inspect cookies, localStorage, sessionStorage, or account pages, or attempt login automation. Tell the user exactly where to get the token and how to paste it back.',
471
+ '- If setup cannot continue because connect_token or api_token is missing, do not inspect browser state or ask for the token. Show the connection URL and request only the 5-minute one-time code, then exchange it with CLI login --code or MCP exchange_connection_code.',
472
472
  '- The user does not need to say "onboarding". After connection succeeds, continue into project selection, workspace file writing, and the first service questions automatically.',
473
- '- Prefer a single start_project_session tool call when it is available. It combines session lookup, project choice handling, workspace file instructions, and first questions.',
473
+ '- When the CLI cannot be installed or executed, prefer a single start_project_session tool call for the MCP fallback. It combines session lookup, project choice handling, workspace file instructions, and first questions.',
474
474
  '- If an MCP response includes workspace_setup.files, write those files into the current working folder immediately before replying.',
475
475
  '- If an MCP response includes local_file_operations, execute those local file writes/appends before replying to the user.',
476
- '- At the start of every new distinct JoripSpace task, call prepare_project_workspace before answering, planning, asking questions, or starting work. A new chat does not prove that the local guide is current, and a same-day guide update must not be skipped. Do not use cron or ask the user to run a refresh command.',
477
- '- Compare the returned AGENTS.md managed block and agent_guide.updated_at with the local JoripSpace managed block on every task-start check. When it differs, replace only the JoripSpace block and preserve user-authored content. Keep `@AGENTS.md` as the first unique CLAUDE.md line, validate `.joripspace/project`, and upsert `.env.joripspace` without discarding unrelated entries. Migrate a legacy token-bearing `.joripspace/agent-session.json` into the env file and remove it only after verification.',
476
+ '- At the start of every new distinct JoripSpace task, refresh through CLI start when available; in the MCP fallback, call prepare_project_workspace before answering, planning, asking questions, or starting work. A new chat does not prove that the local guide is current, and a same-day guide update must not be skipped. Do not use cron or ask the user to run a refresh command.',
477
+ '- Compare the returned AGENTS.md managed block and agent_guide.updated_at with the local JoripSpace managed block on every task-start check. When it differs, replace only the JoripSpace block and preserve user-authored content. Keep `@AGENTS.md` as the first unique CLAUDE.md line, validate `.joripspace/project`, and upsert `.env.joripspace` without discarding unrelated entries. Delegate legacy credential migration to the installed CLI without reading or printing credential values; remove a legacy session file only after CLI migration is verified.',
478
478
  '- Before application work in a Git-history template project, read `.joripspace/template.json` and use the installed JoripSpace CLI `template pull` check to compare its `git_head_sha` with the latest entitled version. This check must not download a bundle or modify Git. When an update exists, report its version plus the local working-tree state and ask for explicit user approval. Only after approval, rerun the CLI command with `--yes`; it replaces `.git/joripspace/upstream.bundle`, fetches `upstream/main`, and merges the official descendant while preserving the user `origin`. If the user declines, continue without updating. Never pull automatically and never download or merge an update automatically; when there are uncommitted changes, rewritten history, divergence, or likely conflicts, stop and explain the safe next action.',
479
479
  '- If the current request is only to update or refresh the guide, follow the shared guide-refresh-only rules. Do not turn that maintenance request into source work, a checkpoint, Git activity, GitHub Actions, or deployment.',
480
480
  '- When MCP connection and workspace setup succeed, run the local Git and Node.js readiness check before the first service question. Ask about installation only when a missing tool is required for the current path; otherwise continue without installation. Never ask the user to run npm or git commands, locate API environment variables, or repeat the connection token.',
@@ -484,7 +484,7 @@ const AFTER_CONNECTION_RULE_LINES = [
484
484
  '- If the user says they do not know what to build, suggest 2-3 simple service examples and pick a practical default.',
485
485
  '- Whenever those examples or any other concrete alternatives require the user to choose, follow the shared user choice presentation rules and show them as a Markdown table.',
486
486
  '- End each user-facing reply with the next thing to click, check, or answer.',
487
- '- If MCP tools do not appear immediately in an app, do not require a restart. Continue the current task with the installed JoripSpace CLI absolute path; prefer MCP automatically in a later session when it is active.',
487
+ '- If MCP tools do not appear immediately in an app, do not require a restart. Continue the current task with the installed JoripSpace CLI absolute path; keep the CLI preferred in later sessions whenever installation and execution are supported, even if MCP becomes active.',
488
488
  ];
489
489
 
490
490
  const REQUIRED_ONBOARDING_MARKERS = [
@@ -510,13 +510,10 @@ const REQUIRED_ONBOARDING_MARKERS = [
510
510
  'deployment_verification.agent_guide_updated_at',
511
511
  'source_compatibility to joripspace_native or converted_to_joripspace',
512
512
  'Framework selection rules (agent decides internally)',
513
- 'Use a pure Cloudflare Worker for a new, single-purpose feature',
514
- 'Use Hono when the service has multiple APIs or routes',
515
- 'If routing would otherwise grow into a hand-written if/switch dispatch structure, use Hono instead',
516
- 'If the choice between a pure Worker and Hono is ambiguous, choose Hono',
513
+ 'Use Hono as the default server framework for every new project, including single-route and simple services',
514
+ 'Do not migrate an existing project to Hono solely because Hono is the default for new projects',
515
+ 'For new projects, use Hono routing instead of a hand-written if/switch dispatch structure',
517
516
  'Do not downgrade Hono merely because a bundled entrypoint uses `export { app as default }`',
518
- 'Re-evaluate this choice as the service grows',
519
- 'migrate it to Hono during the task without asking the user to choose a framework',
520
517
  'A short, single-purpose service may keep its implementation in one Worker entry file',
521
518
  'split the source into role-based modules such as routes, middleware, services, repositories, and utilities',
522
519
  'Do not combine all implementation into worker.js merely to reduce the source file count',
@@ -540,7 +537,7 @@ const REQUIRED_ONBOARDING_MARKERS = [
540
537
  'JoripSpace project secrets',
541
538
  'Only the selected project User Worker secret binding stores the value',
542
539
  'Secret values never appear in list responses',
543
- '제가 직접 확인하고 진행할까요?',
540
+ 'Internal generation does not need duplicate consent or browser registration.',
544
541
  'do not stop by asking them to determine the key name or purpose',
545
542
  'Do not ask for duplicate consent before browser assistance',
546
543
  'Every user-facing request for an external provider credential must include a clickable Markdown link',
@@ -556,7 +553,7 @@ const REQUIRED_ONBOARDING_MARKERS = [
556
553
  'project.secrets.generate',
557
554
  '.env.joripspace',
558
555
  'JORIPSPACE_GUIDE_CHECKED_AT',
559
- 'never duplicate its value in JSON',
556
+ 'Never duplicate the value in JSON, TOML, source, another session file, or MCP client configuration.',
560
557
  'The shared project identity is the one-line `.joripspace/project` slug.',
561
558
  'Realtime inquiry',
562
559
  'After MCP or CLI setup',
@@ -585,7 +582,7 @@ const REQUIRED_ONBOARDING_MARKERS = [
585
582
  'server/API requests 300,000',
586
583
  'Build and deployment defaults',
587
584
  'Image and file placement defaults',
588
- 'Use a pure Cloudflare Worker',
585
+ 'Use Hono as the default server framework',
589
586
  'Vite assets',
590
587
  'Next.js static export',
591
588
  'OpenNext',
@@ -695,7 +692,7 @@ function projectDeploymentRoutingLines(projectConfig = {}) {
695
692
  return [
696
693
  'Current deployment route: direct JoripSpace deployment.',
697
694
  '- A normal user request such as "배포해줘" is sufficient. Do not ask the user to choose GitHub or repeat deployment plumbing.',
698
- '- Run the required checks, then use the JoripSpace MCP checkpoint/deployment path when active or the installed JoripSpace CLI absolute path returned by `start`. Use a verified pre-existing direct package helper only as conditional legacy compatibility.',
695
+ '- Run the required checks, then prefer the installed JoripSpace CLI absolute path returned by `start` even when MCP is active; use the MCP checkpoint/deployment path only when CLI installation or execution is unavailable. Use a verified pre-existing direct package helper only as conditional legacy compatibility.',
699
696
  '- Do not create a GitHub Actions workflow or push to GitHub solely to deploy while the project connection is absent, disconnected, invalid, or suspended.',
700
697
  ];
701
698
  }
@@ -708,45 +705,60 @@ function projectSecretManagementLines(projectConfig = {}) {
708
705
  ];
709
706
  }
710
707
 
711
- function projectAgentsFile() {
708
+ function projectManagedAgentsBlock() {
712
709
  return [
713
710
  '<!-- joripspace:start -->',
714
711
  '',
712
+ '**JoripSpace managed instructions**',
713
+ '',
714
+ 'JoripSpace updates only this marked section. Preserve all user instructions outside it.',
715
+ '',
715
716
  JORIPSPACE_CLI_GUIDE,
716
717
  '',
717
718
  'Public onboarding reference: https://api.joripspace.com/onboarding.md',
718
719
  '',
719
720
  'The JoripSpace project is stored in `.joripspace/project`.',
720
721
  '',
721
- 'Use the installed JoripSpace CLI for JoripSpace infrastructure, domains, and deployment. Do not configure or wait for MCP.',
722
+ 'For CLI sessions: Use the installed JoripSpace CLI for JoripSpace infrastructure, domains, and deployment. Do not configure or wait for MCP. For an existing MCP session, use its advertised tools and the web handoffs described above.',
722
723
  '',
723
724
  '<!-- joripspace:end -->',
724
725
  ].join('\n');
725
726
  }
726
727
 
728
+ function projectAgentsFile() {
729
+ return upsertProjectAgentsContent('').trimEnd();
730
+ }
731
+
727
732
  function projectClaudeFile() {
728
733
  return '@AGENTS.md\n';
729
734
  }
730
735
 
731
736
  function upsertProjectAgentsContent(existingContent = '', projectConfig = {}) {
732
- const managed = projectAgentsFile(projectConfig).trim();
737
+ const managed = projectManagedAgentsBlock();
733
738
  const existing = String(existingContent || '');
734
- if (!existing.trim()) return `${managed}\n`;
735
739
  const markerPairs = [
736
740
  ['<!-- joripspace:start -->', '<!-- joripspace:end -->'],
737
741
  ['<!-- joripspace:managed:start -->', '<!-- joripspace:managed:end -->'],
738
742
  ];
739
743
  let unmanaged = existing;
740
744
  for (const [startMarker, endMarker] of markerPairs) {
741
- const starts = unmanaged.split(startMarker).length - 1;
742
- const ends = unmanaged.split(endMarker).length - 1;
743
- if (starts !== ends) throw new Error('AGENTS.md의 JoripSpace 관리 영역이 손상되었습니다.');
744
- const escapedStart = startMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
745
- const escapedEnd = endMarker.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
746
- unmanaged = unmanaged.replace(new RegExp(`${escapedStart}[\\s\\S]*?${escapedEnd}`, 'g'), '');
745
+ while (unmanaged.includes(startMarker) || unmanaged.includes(endMarker)) {
746
+ const start = unmanaged.indexOf(startMarker);
747
+ const end = unmanaged.indexOf(endMarker);
748
+ if (start < 0 || end < start) throw new Error('AGENTS.md의 JoripSpace 관리 영역이 손상되었습니다.');
749
+ unmanaged = `${unmanaged.slice(0, start)}${unmanaged.slice(end + endMarker.length)}`;
750
+ }
747
751
  }
748
752
  const preserved = unmanaged.trim();
749
- return preserved ? `${preserved}\n\n${managed}\n` : `${managed}\n`;
753
+ const userSection = [
754
+ '# User instructions',
755
+ '',
756
+ '<!-- Add the instructions you want the AI to follow below. JoripSpace preserves this section when updating its managed instructions. Do not include passwords, API keys, or other secrets. -->',
757
+ ].join('\n');
758
+ const userContent = /^#{1,6}\s+User instructions\s*$/im.test(preserved)
759
+ ? preserved
760
+ : preserved ? `${userSection}\n\n${preserved}` : userSection;
761
+ return `${userContent}\n\n${managed}\n`;
750
762
  }
751
763
 
752
764
  function projectMarkerFile(projectConfig = {}) {
@@ -794,10 +806,10 @@ const REQUIRED_SCRIPTS = {
794
806
  const OPTIONAL_DEPLOY_SCRIPT = 'node .joripspace/save.mjs --deploy';
795
807
  const ENTRYPOINT_CANDIDATES = ['worker.js', 'src/worker.js', 'src/index.js', 'server.js', 'dist/worker.js'];
796
808
  const RECOMMENDED_STACK_ORDER = [
797
- '1. Keep the current stack for an existing project unless complexity or compatibility requires a change.',
798
- '2. Pure Worker for one simple purpose without shared middleware.',
799
- '3. Hono for multiple routes, shared auth/CORS/validation/error handling, hand-written routing growth, or ambiguity.',
800
- '4. Re-evaluate and migrate a growing pure Worker to Hono while preserving behavior.',
809
+ '1. Keep the current stack for an existing project; do not migrate it solely to adopt the new-project default.',
810
+ '2. Hono is the default server framework for every new project, including single-route and simple services.',
811
+ '3. Use Hono routes and shared middleware for new-project APIs, authentication, CORS, validation, and error handling.',
812
+ '4. When the user requests a framework migration, preserve existing URLs, behavior, bindings, and user data.',
801
813
  '5. Server-render every user-facing route by default, including login, account, admin, and dashboards.',
802
814
  '6. Plain HTML/CSS/JS or Vite frontend structure as appropriate, with server-rendered initial HTML.',
803
815
  '7. Other Cloudflare-compatible framework output when the existing project requires it.',
@@ -818,7 +830,7 @@ const IMAGE_AND_FILE_PLACEMENT = {
818
830
  const CAPABILITIES = {
819
831
  server: {
820
832
  available: true,
821
- agent_path: 'Use MCP deploy_code for intact small source. Use the installed JoripSpace CLI absolute path for generated bundles and large projects so local bytes are uploaded in verified chunks.',
833
+ agent_path: 'Prefer the installed JoripSpace CLI absolute path for all deployments, including generated bundles and large projects. Use MCP deploy_code for intact small source only when the CLI cannot run.',
822
834
  user_words: '서버 배포 가능'
823
835
  },
824
836
  db: {
@@ -2375,6 +2387,7 @@ function projectAgentSessionFile(projectConfig = {}) {
2375
2387
  }
2376
2388
 
2377
2389
  module.exports = {
2390
+ JORIPSPACE_TOOL_SELECTION_LINES,
2378
2391
  JORIPSPACE_CLI_GUIDE,
2379
2392
  JORIPSPACE_NPM_ONBOARDING_DOCUMENT,
2380
2393
  JORIPSPACE_AGENT_GUIDE_UPDATED_AT,