@joripspace/cli 0.6.1 → 0.8.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joripspace/cli",
3
- "version": "0.6.1",
3
+ "version": "0.8.0",
4
4
  "license": "MIT",
5
5
  "description": "The official JoripSpace CLI. Build and deploy web apps with AI agents. Powered by Cosmosfarm.",
6
6
  "type": "commonjs",
@@ -1,10 +1,11 @@
1
1
  // Shared by CLI responses, generated documents, public onboarding, and MCP guidance.
2
2
  const JORIPSPACE_TOOL_SELECTION_LINES = [
3
+ 'Reuse existing valid CLI logins and authenticated MCP sessions without a new approval. New CLI connections use login --no-open --json: show approval_url from stderr, keep the process running, and follow the final stdout next_action/next_command. No code entry is required. For MCP initialize the transport, retain Mcp-Session-Id, and call start_login without arguments; show approval_url, then respect interval and call start_login with the returned request_id in the same session until connected. Continue with start_project_session without token arguments. Pending means wait; denial, expiry and errors must not switch flows or create duplicate approvals. Never request or expose a token; do not browse around or inspect browser storage. The server alone retains old code APIs for already released clients; current clients never fall back to a code flow.',
3
4
  'Discover capabilities for the current installation instead of memorizing a static feature list: read CLI --help, then the relevant command help; use knowledge search --query for task-specific guidance. In MCP-only environments, inspect tools/list and the selected tool inputSchema, then resources/list and only the relevant manual. Recheck help/schema after an update or unknown option; generic global help is not proof that an invented command exists. Do not load all manuals or duplicate every tool option into AGENTS.md.',
4
- 'When the user requests a platform problem report or improvement suggestion, use CLI report --help and submit report with category problem, bug, or feedback as appropriate. feedback is a report category, not a CLI command or MCP tool. Sending a report requires the user request or existing explicit authorization; never silently send suggestions. Include only relevant non-secret diagnostics and return the actual report_id. If submission status is unknown, do not blindly retry.',
5
- 'For an exposed connection token, use CLI tokens revoke --current (or --token-id ID); if CLI is unavailable, use MCP revoke_api_token with token_id=current or an exact same-account ID. Never guess a target or read/print the secret. Revoking current ends the connection; reconnect with a fresh code. logout alone does not revoke.',
5
+ 'When the user requests a platform problem report or improvement suggestion, use CLI report --help for problems and bugs, or feedback --help for suggestions. CLI feedback wraps report --category feedback with the same arguments, authentication, submission and response. On older CLIs without feedback, use report --category feedback. MCP sessions submit through the CLI; there is no direct MCP report or feedback tool. Sending a report requires the user request or existing explicit authorization; never silently send suggestions. Include only relevant non-secret diagnostics and return the actual report_id. If submission status is unknown, do not blindly retry.',
6
+ 'For an exposed connection token, use CLI tokens revoke --current (or --token-id ID); if CLI is unavailable, use MCP revoke_api_token with token_id=current or an exact same-account ID. Never guess a target or read/print the secret. Revoking current ends the connection; reconnect through login approval. logout alone does not revoke.',
6
7
  'Prefer the JoripSpace CLI even when MCP tools are available. For generated bundles and large projects, the CLI uploads local bytes in verified chunks. Before each new onboarding, resolve the executable and compare its --version with npm view @joripspace/cli@latest version. An existing installation is not evidence that it is current. When Node.js 18+ and npm, terminal, file, and network access permit installation, install or update with npm install -g @joripspace/cli@latest. Verify the actual executable version again after installation. If PATH or a saved invocation still selects an older native binary, npm prefix, or npx cache entry, use Node with the absolute npm root -g package entrypoint or npx -y @joripspace/cli@latest, verify its version against the registry, and use that verified invocation for start and subsequent commands. Do not claim an update succeeded merely because npm install exited successfully. If the registry cannot be reached, state that freshness is unverified and continue only with capabilities confirmed in the installed help. If the global prefix is not writable, use npx -y @joripspace/cli@latest instead. Do not change global agent configuration or elevate solely for CLI installation.',
7
- 'Use CLI start PROJECT --json and its onboarding.invocation for subsequent operations. MCP tool availability alone does not prove CLI authentication: reuse an existing authorized CLI login or an existing locally authenticated .env.joripspace. If neither authenticates, complete the CLI one-time-code flow. Never extract hidden MCP client credentials or duplicate tokens into client configuration. If the CLI cannot be installed or executed, continue with the available MCP tools and their existing authorized connection. Do not block supported MCP work merely because the CLI environment is unavailable.',
8
+ 'Use CLI start PROJECT --json and its onboarding.invocation for subsequent operations. MCP tool availability alone does not prove CLI authentication: reuse an existing authorized CLI login or an existing locally authenticated .env.joripspace. If neither authenticates, prefer approval-link login when supported, otherwise use the legacy CLI one-time-code flow. Never extract hidden MCP client credentials or duplicate tokens into client configuration. If the CLI cannot be installed or executed, continue with the available MCP tools and their existing authorized connection. Do not block supported MCP work merely because the CLI environment is unavailable.',
8
9
  ];
9
10
 
10
11
  const JORIPSPACE_CLI_GUIDE = [
@@ -19,12 +20,13 @@ const JORIPSPACE_CLI_GUIDE = [
19
20
  '',
20
21
  ...JORIPSPACE_TOOL_SELECTION_LINES,
21
22
  '',
23
+ 'The current npm-distributed CLI requires Node.js 18+ and npm for installation or npx execution. A working CLI does not require a second project-local Node.js installation. Small-source MCP-only connection and deployment need neither Node.js nor Git; a connected GitHub source still requires Git. Check the actual path rather than applying legacy standalone CLI requirements to the current npm package.',
22
24
  'Use the project name supplied by the user. The connection flow does not create a missing project. Use the current Git root when one exists, otherwise the current working directory; use --cwd to specify the intended workspace. Never use the npm cache or package installation folder as the project workspace.',
23
25
  "Only when the user explicitly requests a new Free project, run create --name NAME --json. Present every returned agreement faithfully in the user's language, link to the terms, and obtain explicit consent before passing --agree-noncommercial --agree-billing --agree-retention. Never infer agreement from the creation request. start never creates a project, and create does not link the workspace. If creation state is unknown, list projects and check the name before retrying.",
24
26
  'The JoripSpace project is stored in `.joripspace/project`. Resolve different or invalid markers, symlinks, and conflicting local work without overwriting user files.',
25
27
  'For CLI sessions: Use the installed JoripSpace CLI for JoripSpace infrastructure, domains, and deployment. Do not configure or wait for MCP. Existing MCP integrations remain available for users who choose that workflow; this start session continues through the CLI.',
26
- 'For an existing MCP session, use the tools advertised by that connection. create_project creates only Free projects after explicit confirmation and all returned agreements; start_project_session connects an existing project. MCP supports DB, storage, deployment, checkpoints, domains, crons, mail, realtime, and value-blind Secret generation/listing. Internal random Secret generation is available through generate_project_secret without another confirmation when the task already authorizes it. External Secret registration/replacement uses CLI secret set --value-stdin when a safe authorized input is available; use the project Secret web page when user-only entry is needed. MCP has no arbitrary-value Secret registration tool. MCP authentication stays in its server-bound transport session or client-managed OAuth connection. MCP responses and workspace metadata never carry API token values. CLI login stores its own credentials locally; an existing locally authenticated project env remains supported. Do not copy MCP credentials into local files or client configuration. When switching to CLI, use its own connection-code login if no authorized CLI login exists.',
27
- 'When start returns connection_required, show connect_url as a clickable link, ask the user to approve the connection and provide the five-minute one-time code, then execute login_command and resume_command. A successful connection also logs in; do not add a separate login step. Never request or print the exchanged token. Reuse the existing connection on later runs. Use logout to remove the current local login without revoking server tokens.',
28
+ 'For an existing MCP session, use the tools advertised by that connection. create_project creates only Free projects after explicit confirmation and all returned agreements; start_project_session connects an existing project. MCP supports DB, storage, deployment, checkpoints, domains, crons, mail, realtime, and value-blind Secret generation/listing. Internal random Secret generation is available through generate_project_secret without another confirmation when the task already authorizes it. External Secret registration/replacement uses CLI secret set --value-stdin when a safe authorized input is available; use the project Secret web page when user-only entry is needed. MCP has no arbitrary-value Secret registration tool. MCP authentication stays in its server-bound transport session or client-managed OAuth connection. MCP responses and workspace metadata never carry API token values. CLI login stores its own credentials locally; an existing locally authenticated project env remains supported. Do not copy MCP credentials into local files or client configuration. When switching to CLI, run its own login approval-link flow if no authorized CLI login exists.',
29
+ 'When start returns connection_required, execute login_command, show approval_url from stderr, keep that process alive until connected, then run resume_command. Reuse the connection on later runs. Never request or print a code or token. logout removes the local login without revoking server tokens.',
28
30
  'New CLI logins prefer the OS credential store and reuse it across project folders for the same OS user. When that store is available, `.env.joripspace` keeps only the API URL and account reference. If the OS store is unavailable before writing, login saves the token in the project-local `.env.joripspace` instead; that fallback is reused only in this project. Failed OS writes or readback verification do not trigger fallback. Older CLI versions and existing token-bearing `.env.joripspace` files remain supported; keep that file Git-ignored and excluded from deployments and checkpoints. logout removes saved project tokens and the matching OS-stored account credential. OS logins are shared across project folders, including folders where logout was previously run. Do not copy credentials into documents, skills, logs, or source code.',
29
31
  '',
30
32
  '## Execute commands reliably',
@@ -37,8 +39,8 @@ const JORIPSPACE_CLI_GUIDE = [
37
39
  '',
38
40
  '## Agent documents',
39
41
  '',
40
- 'start maintains one bounded JoripSpace block in AGENTS.md, one @AGENTS.md reference in CLAUDE.md, and the canonical project marker. Existing user content is preserved. Read AGENTS.md explicitly when automatic loading is unavailable. User-authored agent instructions still apply.',
41
- 'This guide is returned inline by start and written into AGENTS.md. Skills are optional: this workflow does not require a plugin, agent detection, or skill registration. Do not modify global agent configuration. At the beginning of a new JoripSpace task, run start for the same project to refresh state and managed guidance while preserving local work.',
42
+ 'start maintains one bounded JoripSpace block in AGENTS.md, one @AGENTS.md reference in CLAUDE.md, and the canonical project marker. Connection setup and guide refresh do not create application deployment scripts. During authorized app implementation or deployment, prepare the verified build-and-CLI script described below; this is distinct from legacy .joripspace/*.mjs helpers. Existing user content is preserved. Read AGENTS.md explicitly when automatic loading is unavailable. User-authored agent instructions still apply.',
43
+ 'This guide is returned inline by start and written into AGENTS.md. Skills are optional: this workflow does not require a plugin, agent detection, or skill registration. Do not modify global agent configuration. At the beginning of a new JoripSpace task, run start for the same project to refresh state and managed guidance while preserving local work, except for a guide-refresh-only request. start can synchronize application source; never run it merely to refresh guidance. For guide-only maintenance, use authenticated MCP prepare_project_workspace with guide_only=true. If MCP is unavailable, fetch https://api.joripspace.com/onboarding.md, extract the guide beginning at # JoripSpace project onboarding, and replace only the bounded JoripSpace AGENTS.md block while preserving user content; maintain the CLAUDE.md import. Preserve the existing project marker and credentials. Do not synchronize Git, restore source, migrate legacy helpers, install tools, or deploy for guide-only maintenance. If the local marker or managed block is invalid, report that conflict without changing application files.',
42
44
  '',
43
45
  '## Continue existing work or choose a template',
44
46
  '',
@@ -63,9 +65,11 @@ const JORIPSPACE_CLI_GUIDE = [
63
65
  'Use Hono as the default server framework for every new project, including single-route and simple services. Preserve the current framework of an existing project unless the user requests migration. Use feature-focused modules as complexity grows and deploy them as one bundled Worker service.',
64
66
  'Server-render meaningful initial HTML for user-facing routes by default. Honor an explicitly requested SPA, client-only app, or WebView. Give each independent main screen a distinct pathname that supports direct access and refresh; verify the route inventory, requested flows, validation, authorization, responsive layout, and relevant automated checks before deployment.',
65
67
  'Before deployment, inspect runtime imports. When source imports package dependencies, run the project build and deploy its generated bundled Worker entrypoint such as dist/worker.js. Never deploy an unbundled source entrypoint that depends on excluded node_modules.',
68
+ 'After implementing or changing an app build, make its deployment repeatable in the project. For direct deployments with package.json, build first, inspect the actual bundled output and assets, check deploy --help with the verified CLI invocation, and only if --prepare is advertised run deploy --prepare --dir OUTPUT_DIRECTORY --entrypoint WORKER_FILE --json. Paths are relative to the workspace; entrypoint is relative to the output directory. This validates the output and adds joripspace:deploy while preserving other scripts and refusing to overwrite a different deployment script. It does not deploy. Do not run preparation in an empty workspace or merely to refresh guidance. Check deploy --help before using --prepare. For a released CLI without --prepare, add the equivalent portable package script directly after verifying the output: "joripspace:deploy": "npm run build && npx --yes @joripspace/cli@latest deploy --cwd . --dir \"dist\" --entrypoint \"worker.js\"". Replace dist and worker.js with the actual verified paths; omit npm run build && only when the project has no build step. Preserve every other script and do not overwrite an existing custom deployment script. Do not add a project CLI dependency or machine-specific path. Never pass --prepare when help does not advertise it. For MCP-only execution, record the same verified build/output/entrypoint in the project AGENTS.md and use advertised tools.',
69
+ 'When deployment of the current change is requested, reuse npm run joripspace:deploy -- --label "Describe the change" after confirming the project still uses direct deployment. The script builds first and stops on build failure. It resolves the current CLI through npx without committing machine-specific paths or credentials. Inspect package.json before executing it; preserve custom scripts. GitHub-connected projects keep their configured workflow and trigger and must not prepare or run a direct deployment script. Verify deployment history and production HTTP responses after execution.',
66
70
  'Directory deployment applies root .gitignore, .ignore, .joripspaceignore and nested .gitignore rules to both small inline uploads and chunked archives. Ignored credentials and protected connection files are excluded in both paths. If the build output is ignored in the project root, select the build output directory with --dir instead of removing credential ignore rules.',
67
71
  'Respect context.deployment returned by start; for older CLIs that omit it, run get --project PROJECT --json before choosing a deployment route. With an active GitHub deployment connection, follow its configured branch and trigger, commit and push the verified requested change, and verify the resulting Actions run and JoripSpace deployment. Do not create a separate pre-push checkpoint or use direct deploy for that route. Otherwise use the existing CLI deployment/checkpoint commands. Do not create GitHub Actions workflows merely to deploy an unconnected project. Store external provider secrets in project Secret bindings through the existing authorized flow, never in application source.',
68
- 'When GitHub connection is requested, show https://joripspace.com/projects/PROJECT/?tab=deployment as a clickable link with the selected project slug. The user connects the GitHub App and selects the repository and trigger on that page. Keep the existing GitHub Actions workflow. An authorized agent push to the configured branch triggers automatic deployment for a branch-push connection; follow the configured release trigger for release deployments. Check project status and deployment history afterward.',
72
+ 'When GitHub connection is requested, show https://joripspace.com/projects/PROJECT/?tab=deployment as a clickable link with the selected project slug. The user connects the GitHub App and selects the repository and trigger on that page. Preserve user-authored workflows. For a missing or stale connection-managed workflow, use github prepare only when advertised by CLI help, after the application entrypoint exists; do not create workflows for an unconnected project. An authorized agent push to the configured branch triggers automatic deployment for a branch-push connection; follow the configured release trigger for release deployments. Check project status and deployment history afterward.',
69
73
  'When development and deployment are requested, verify the build, deploy through JoripSpace, and check the production URL before reporting completion. Report the URL, actual verification, and any unresolved failure. If a response is lost, inspect deployment state before retrying a mutation. For transient reads, follow retryable and retry-after information with bounded backoff. Do not blindly retry authentication, permission, conflict, or invalid-input failures.',
70
74
  'Deployment requires an explicit request for the current change. After meaningful verified work without deployment, use checkpoint save with a concise label. A request only to refresh guidance does not authorize application changes, checkpoints, commit, push, or deployment; preserve existing application source and do not invent a deployment because guide files changed.',
71
75
  '',
@@ -79,7 +83,7 @@ const JORIPSPACE_CLI_GUIDE = [
79
83
  '## Project secrets',
80
84
  '',
81
85
  'A request to generate an internal Secret, or its necessity within authorized implementation, is sufficient authorization; do not ask for duplicate consent or browser registration. Infer the binding name from the project and ask only if its purpose is ambiguous. Use secret generate --name NAME --json to create an internal random secret without seeing its value. It preserves an existing active secret. Use secret set --name NAME --value-stdin --json (alias: secret update) to create or replace a binding with an authorized value from an external server, provider, or system. Pass the exact UTF-8 bytes through process standard input, never command arguments, chat, logs, source, or temporary project files. No secret value is returned. set/update both create or replace; deleting a secret remains a web operation.',
82
- 'The start onboarding object and secret list/generate/set/update results include secret_management_url for the selected project. Include this as a clickable link when reporting creation or replacement, and whenever the user needs to enter or change a value. Explain the exact key name and purpose in the user\'s language. If the user must enter a provider-issued value, ask them to enter it on that page and click Register or replace, then verify the name, status, and updated_at with secret list --json. Do not ask for secret values in chat. Perform the relevant connection check before reporting that an integration works.',
86
+ 'The start onboarding object and secret list/generate/set/update results include secret_management_url for the selected project. Include this as a clickable link when reporting creation or replacement, and whenever the user needs to enter or change a value. Explain the exact key name and purpose in the user\'s language. For a provider-issued value the user must enter, first run secret list --name NAME --json. Show the returned secret_management_url with secret_name, explain its purpose and ask for only the value on that page. The name is prefilled and the value field focused. Do not generate a placeholder value. Wait for user confirmation, then verify with secret list --name NAME --json. An existing active key is preserved unless replacement is needed for the requested task; for replacement require updated_at newer than the initial secret_entry.previous_updated_at. A saved key does not by itself prove the external integration works. Do not ask for secret values in chat. Perform the relevant connection check before reporting that an integration works.',
83
87
  ].join('\n');
84
88
 
85
89
  const JORIPSPACE_NPM_ONBOARDING_DOCUMENT = [
@@ -15,7 +15,7 @@ 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-10-24T22:35:07+09:00';
18
+ const JORIPSPACE_AGENT_GUIDE_UPDATED_AT = '2026-11-04T12:13:33+09:00';
19
19
  const JORIPSPACE_WORKFLOW_POLICY = Object.freeze({
20
20
  target: 'joripspace',
21
21
  guide_required: true,
@@ -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
- '- 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.',
123
+ '- For a user-requested platform problem report or improvement suggestion, submit one incident with the installed CLI `report` command for problems or bugs, or the `feedback` command for suggestions, after reading the corresponding --help. CLI feedback wraps report --category feedback; use that legacy form when feedback is unavailable. MCP sessions also submit through CLI feedback, not a direct MCP tool. 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 = [
@@ -138,7 +138,7 @@ const LOCAL_TOOL_READINESS_RULE_LINES = [
138
138
  'Local Git and Node.js readiness during onboarding:',
139
139
  '- After the project connection succeeds and the project path is known, check `git --version`, `node --version`, and `npm --version` directly before the first source-sync or local build step that could require them. Do not ask the user to run these commands.',
140
140
  '- Show the result in one readable Markdown table with columns for tool, status, version, and whether it is needed for the current project path.',
141
- '- Decide need from the actual path: Git is required for a connected GitHub repository, clone/fetch, commit, push, or a template installation mode that preserves Git history. Git is not required when the user chooses a files-only template installation. Node.js LTS and npm are required only for project dependency installation, local JavaScript builds, or an explicitly selected verified legacy package helper. The installed JoripSpace CLI handles checkpoint, restore, pull, generated bundles, and large archive deployment without project-local Node.js. Ordinary MCP and CLI onboarding require neither tool.',
141
+ '- Decide need from the actual path: Git is required for a connected GitHub repository, clone/fetch, commit, push, or a template installation mode that preserves Git history. Git is not required when the user chooses a files-only template installation. The npm-distributed JoripSpace CLI requires Node.js 18+ at runtime and npm for installation or npx execution. Project dependency installation and local JavaScript builds also require the relevant runtime. Ordinary small-source MCP onboarding and direct MCP deployment require neither Git nor Node.js. A working legacy standalone CLI may be reused only with capabilities verified in its help; do not confuse that legacy executable with the current npm CLI.',
142
142
  '- If every missing tool is optional for the current path, say it is optional and continue onboarding without asking to install it.',
143
143
  '- If a required tool is missing, explain its immediate purpose in one sentence and ask for one explicit approval to install only the missing required tools. Do not install software before approval and do not combine this approval with unrelated choices.',
144
144
  "- After approval, install stable Git and/or the current Node.js LTS with npm using the operating system's standard trusted package manager. Perform the installation yourself, request elevation only through the normal operating-system prompt, and never disable security controls or use an untrusted download source.",
@@ -149,7 +149,7 @@ const LOCAL_TOOL_READINESS_RULE_LINES = [
149
149
  const GUIDE_REFRESH_ONLY_RULE_LINES = [
150
150
  'Guide refresh is maintenance-only unless deployment is separately explicit:',
151
151
  '- Treat requests whose only intent is "지침 업데이트해", "지침 갱신해", "최신 지침 적용해", "refresh the guide", or equivalent wording as local guide maintenance only. They are not authorization to build, test the application, create a checkpoint, stage files, commit, push, run GitHub Actions, or deploy.',
152
- '- For a guide-refresh-only request, call prepare_project_workspace and update only the JoripSpace managed block in AGENTS.md, the first-line `@AGENTS.md` import in CLAUDE.md, the canonical `.joripspace/project` marker, plus `JORIPSPACE_GUIDE_CHECKED_AT` in `.env.joripspace`. Preserve user-authored content and unrelated environment entries, and do not modify application source, workflow files, or deployment configuration merely to refresh the guide.',
152
+ '- For a guide-refresh-only request, call prepare_project_workspace with guide_only=true (use the public onboarding guide without CLI start when MCP is unavailable) and update only the JoripSpace managed block in AGENTS.md, the first-line `@AGENTS.md` import in CLAUDE.md, the canonical `.joripspace/project` marker, plus `JORIPSPACE_GUIDE_CHECKED_AT` in `.env.joripspace`. Preserve user-authored content and unrelated environment entries, and do not modify application source, workflow files, or deployment configuration merely to refresh the guide.',
153
153
  '- Do not run create_checkpoint, joripspace:save, deploy_code, deploy_checkpoint, rollback_deployment, git add, git commit, git push, or any deployment workflow for a guide-refresh-only request, even when the project uses GitHub Actions or an automatic deployment route.',
154
154
  '- Deployment permission must appear explicitly in the current user request with wording such as "배포해", "운영 반영해", or "사이트에 적용해". A deployment approval from an earlier task or chat message does not carry forward to a later guide refresh.',
155
155
  '- If a current request explicitly combines guide refresh with deployment, refresh first, then deploy only the application changes the user explicitly placed in scope after the normal verification gate. Do not manufacture an application deployment merely because managed guide files changed.',
@@ -192,10 +192,9 @@ 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 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.',
195
+ '- Without an authenticated MCP transport session, do not call project tools. Reuse client OAuth authentication or complete start_login approval 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 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.',
197
+ '- Reuse existing valid CLI logins and authenticated MCP sessions without a new approval. New CLI connections use login --no-open --json: show approval_url from stderr, keep the process running, and follow the final stdout next_action/next_command. No code entry is required. For MCP initialize the transport, retain Mcp-Session-Id, and call start_login without arguments; show approval_url, then respect interval and call start_login with the returned request_id in the same session until connected. Continue with start_project_session without token arguments. Pending means wait; denial, expiry and errors must not switch flows or create duplicate approvals. Never request or expose a token; do not browse around or inspect browser storage. The server alone retains old code APIs for already released clients; current clients never fall back to a code flow.',
199
198
  '- Do not ask for email, password, Google app password, SMTP password, personal API key, or payment key in chat.',
200
199
  '- 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
200
  '- Do not restart the connection flow for a deployment timeout. Restart connection only for connection_required, invalid_token, or another explicit authentication error.',
@@ -206,12 +205,12 @@ const CODEX_MCP_ONBOARDING_LINES = [
206
205
  '- 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
206
  '- 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.',
208
207
  '- If onboarding.template_choice.status is auto_selected_existing_project, option 0 is already selected because the project has an existing GitHub source or deployment baseline. Do not show a template table and do not ask new-service questions such as the service name, description, or features. After synchronization or restoration, immediately perform the task already requested by the user; if no task was requested, ask only what they want to work on in the existing project.',
209
- '- If the embedded template_choice status says retry_required_before_service_questions, retry start_project_session once with the same project and connection token. Do not report that templates are unavailable and silently skip the choice.',
208
+ '- If the embedded template_choice status says retry_required_before_service_questions, retry start_project_session once with the same project in the authenticated MCP transport session, without token arguments. Do not report that templates are unavailable and silently skip the choice.',
210
209
  '- Only when onboarding.template_choice.status is required_before_service_questions, show option 0 as "Start without a template" and show the embedded selectable templates in a Markdown table. Wait for the user choice; templates are optional.',
211
210
  '- When the user selects a template, run the installed JoripSpace CLI absolute path with `install-template --template TEMPLATE_SLUG --project PROJECT_ID --dir .` without putting any token in the command and without `--force`. Inspect the installed files and complete the required template setup below before continuing the normal service questions and customization. If files collide, overwrite nothing; continue without a template unless the user explicitly approves an overwrite retry.',
212
211
  "- After installing a selected template and before service questions or customization, inspect its code, documentation, configuration, and schema or migration files to determine whether it uses env.DB. When it uses DB, setting up the required project DB is mandatory: call describe_db first, compare the existing schema with the template's actual queries, review tables, indexes, and seed data for compatibility, apply only the required compatible changes with run_db_migration, then verify the resulting schema with describe_db and relevant reads with query_db. Do not merely copy SQL files, expose a public migration route, deploy, or report the template ready while required DB setup is incomplete. If a safe compatible migration cannot be determined, stop and report the specific schema or data conflict instead of guessing, dropping existing data, or resetting the DB.",
213
- '- If start_project_session fails with connection_required, call start_login again. If it fails with invalid_token, ask for a fresh token. If it returns needs_project_choice, ask the user to choose one project and call start_project_session again. If project_not_found, ask the user to confirm the project ID.',
214
- '- Only for a completely new project whose template_choice.status is required_before_service_questions, after the optional template choice ask onboarding questions one at a time: service name, what the service does, three required features, whether login is needed, whether payment/email/file upload/admin is needed, then choose or recommend the deployment target yourself.',
212
+ '- Reuse existing valid CLI logins and authenticated MCP sessions without a new approval. New CLI connections use login --no-open --json: show approval_url from stderr, keep the process running, and follow the final stdout next_action/next_command. No code entry is required. For MCP initialize the transport, retain Mcp-Session-Id, and call start_login without arguments; show approval_url, then respect interval and call start_login with the returned request_id in the same session until connected. Continue with start_project_session without token arguments. Pending means wait; denial, expiry and errors must not switch flows or create duplicate approvals. Never request or expose a token; do not browse around or inspect browser storage. The server alone retains old code APIs for already released clients; current clients never fall back to a code flow.',
213
+ '- Only for a completely new project whose template_choice.status is required_before_service_questions, after the optional template choice collect only the missing service requirements in a single combined service-brief question: name, purpose, required features, login, and integrations. Skip values already provided by the user; follow up only when a missing answer blocks the requested work. Apply the shared framework and deployment rules.',
215
214
  '- When both existing work and a service description are absent, ask once for the company or service, required content, and desired mood. Keep the resulting project brief in the application source only when it is useful to the project.',
216
215
  '- Before deployment, verify the project connection, source entrypoint, relevant checks available in the current environment, and target URL. If runtime source imports package dependencies, run the project build and deploy the generated bundled Worker entrypoint such as dist/worker.js; never deploy an unbundled source entrypoint that depends on node_modules. Direct MCP deployment of Worker-compatible source does not require Node.js or Git.',
217
216
  '- Never obtain a generated bundle or large source file by printing it through a shell/tool output and copying that output into deploy_code. Tool output can be truncated even when the local file is valid. Use the installed JoripSpace CLI absolute path with `deploy --dir` so local bytes, sizes, and hashes are preserved end to end.',
@@ -220,11 +219,9 @@ const CODEX_MCP_ONBOARDING_LINES = [
220
219
  ];
221
220
 
222
221
  const CODEX_MCP_USER_CONNECT_MESSAGE_LINES = [
223
- 'JoripSpace 프로젝트를 Codex에 연결하려면 먼저 5분짜리 일회용 연결 코드가 필요합니다.',
224
- '1. 브라우저에서 아래 링크를 엽니다.',
225
- '2. JoripSpace에 로그인된 상태에서 연결을 승인합니다.',
226
- '3. 화면에 표시되는 MCP/CLI 전용 연결 코드를 이 채팅에 붙여넣습니다. Codex는 이 코드를 exchange_connection_code로 교환한 뒤 받은 연결 토큰으로 프로젝트 세션을 시작합니다.',
227
- '주의: 이메일이나 비밀번호는 필요하지 않습니다. Google 앱 비밀번호나 SMTP 비밀번호를 채팅에 붙여넣지 마세요. Codex가 브라우저 쿠키나 저장소에서 토큰을 직접 찾으면 안 됩니다. 연결 코드는 연결 토큰이 아니며 한 번만 사용할 수 있습니다. 교환 후 발급되는 연결 토큰은 프로젝트 온보딩 세션을 시작하기 위한 값이며, 일반 API bearer token과 다릅니다.',
222
+ 'JoripSpace 연결 승인 링크를 열고 로그인 계정을 확인한 뒤 연결 승인을 눌러주세요.',
223
+ '코드를 복사하거나 채팅에 입력할 필요가 없습니다. 같은 MCP 세션에서 start_login에 request_id를 전달해 승인 상태를 확인하고 연결 후 프로젝트 온보딩을 이어갑니다.',
224
+ '이메일, 비밀번호, API 토큰을 채팅에 입력하지 마세요. 에이전트는 브라우저 쿠키나 저장소에서 인증 정보를 찾지 않습니다.',
228
225
  ];
229
226
 
230
227
  const SECRET_RULE_LINES = [
@@ -235,15 +232,15 @@ const SECRET_RULE_LINES = [
235
232
  '- 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
233
  '- 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
234
  '- 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. 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
- '- 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.',
235
+ '- 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 run CLI secret list --name NAME --json, or MCP list_secrets with name, to prepare a user-entry link without creating a placeholder secret. Show the returned secret_management_url and explain the purpose; the name is prefilled and the user enters only the value. After confirmation verify active metadata; for replacement require updated_at newer than the saved previous_updated_at before checking the integration. 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.',
236
+ '- Every user-facing request for an external provider credential must include a clickable Markdown link to `https://joripspace.com/projects/{project_id}/?tab=secrets&secret_name=NAME`. Include only the validated key name in the URL, never its value. Use the selected project slug in place of `{project_id}`. Never mention only the tab name or provide an unlinked URL.',
240
237
  '- 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
238
  '- 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
239
  "- 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
240
  '- 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
241
  '- 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
242
  '- 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.',
243
+ '- Reuse existing valid CLI logins and authenticated MCP sessions without a new approval. New CLI connections use login --no-open --json: show approval_url from stderr, keep the process running, and follow the final stdout next_action/next_command. No code entry is required. For MCP initialize the transport, retain Mcp-Session-Id, and call start_login without arguments; show approval_url, then respect interval and call start_login with the returned request_id in the same session until connected. Continue with start_project_session without token arguments. Pending means wait; denial, expiry and errors must not switch flows or create duplicate approvals. Never request or expose a token; do not browse around or inspect browser storage. The server alone retains old code APIs for already released clients; current clients never fall back to a code flow.',
247
244
  '- 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
245
  '- 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
246
  '- 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.',
@@ -405,10 +402,10 @@ const AGENT_OPERATING_RULE_LINES = [
405
402
  '- 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.',
406
403
  '- 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.',
407
404
  '- 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.',
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 "복사한_연결_코드"`.',
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.',
405
+ '- Reuse existing valid CLI logins and authenticated MCP sessions without a new approval. New CLI connections use login --no-open --json: show approval_url from stderr, keep the process running, and follow the final stdout next_action/next_command. No code entry is required. For MCP initialize the transport, retain Mcp-Session-Id, and call start_login without arguments; show approval_url, then respect interval and call start_login with the returned request_id in the same session until connected. Continue with start_project_session without token arguments. Pending means wait; denial, expiry and errors must not switch flows or create duplicate approvals. Never request or expose a token; do not browse around or inspect browser storage. The server alone retains old code APIs for already released clients; current clients never fall back to a code flow.',
406
+ '- Legacy scripts that execute .joripspace/*.mjs helpers are conditional compatibility only. New `start` connection setup does not generate them. A verified joripspace:deploy script that builds the app and invokes the current CLI is a supported deployment entrypoint, not a legacy helper. Prepare it only during authorized app implementation or deployment, never merely to link or refresh a workspace.',
410
407
  '- 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.',
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.',
408
+ '- 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 or project-local helper. The current npm CLI needs Node.js 18+; use supported MCP capabilities when that runtime is unavailable, and do not ask the user to choose or run the command.',
412
409
  '- If the project folder has no app code, use the installed CLI deployment pull/restore flow after the required safety check. A verified pre-existing `joripspace:pull` package script may be used only as conditional legacy compatibility.',
413
410
  '- If the user asks to replace local files with the latest deployed version, use the current CLI restore flow; it backs up overwritten files in the user-specific JoripSpace data directory outside the project first.',
414
411
  '- 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.',
@@ -441,17 +438,17 @@ const DEPLOYMENT_VERIFICATION_RULE_LINES = [
441
438
  '- Exercise representative user flows with automated tests, direct function calls, or HTTP requests before deployment. Verify at least the primary read flow and, when the service writes data, one safe create/update/read path plus expected validation and error behavior.',
442
439
  '- Do not open or control a browser for routine implementation or deployment verification. Use browser-based visual or interactive verification only when the user explicitly asks for browser verification. Without such a request, inspect responsive markup and styles and use automated or HTTP checks without claiming browser verification.',
443
440
  '- Perform a focused security review of the changed and exposed paths before deployment. Check authentication and authorization, input validation, injection and unsafe HTML risks, secret or personal-data exposure, sensitive logs/errors, destructive actions, and cache behavior where relevant.',
444
- '- For a project with a user interface, record a route inventory before deployment. Classify it as single-screen or multi-screen. For multi-screen navigation, record every main path and verify pathname-based routing and direct HTTP access with automated checks. Verify browser back/forward interactively only when the user explicitly requests browser verification. A same-URL main-content swap is a blocking deployment failure.',
441
+ '- For a project with a user interface, record a route inventory before deployment. Classify it as single-screen or multi-screen. For multi-screen navigation, record every main path and verify pathname-based routing and direct HTTP access with automated checks. Verify browser back/forward interactively only when the user explicitly requests browser verification. A same-URL main-content swap is a blocking deployment failure unless the user explicitly requested that navigation model; for that exception, verify the requested navigation and state behavior without forcing pathname changes.',
445
442
  '- If any relevant check or scenario fails, fix the problem and rerun the affected checks and scenarios. Do not deploy with a known blocking functional, security, build, or responsive-layout problem.',
446
443
  '- After deployment, verify the actual project root and main changed routes with HTTP requests or available automated checks. Test a safe write flow when applicable, and inspect runtime events when an HTTP response, function, or deployment behaves unexpectedly. Open the project in a browser only when the user explicitly requests browser verification.',
447
- '- After an explicitly requested deployment succeeds and the non-browser post-deployment checks pass, commit the exact deployed project source when Git is available and there are relevant uncommitted changes. Use a concise commit message based on the completed work. Do not create an empty commit, amend an existing commit, invent Git identity, or push unless the user explicitly requested a push.',
444
+ '- After an explicitly requested deployment succeeds and the non-browser post-deployment checks pass, commit the exact deployed project source when Git is available and there are relevant uncommitted changes. Use a concise commit message based on the completed work. Do not create an empty commit, amend an existing commit, invent Git identity, or push unless the user explicitly requested a push or the current authorized GitHub deployment route requires that push.',
448
445
  '- Report which checks and scenarios passed, the deployed URL, and any verification limitation. Never report deployment or verification as successful without evidence.',
449
446
  ];
450
447
 
451
448
  const CHECKPOINT_AGENT_RULE_LINES = [
452
449
  '- After meaningful work and relevant checks, create a JoripSpace checkpoint with create_checkpoint or the installed CLI `checkpoint save` command. Always provide a concise label describing the change. Identical content is reused instead of creating a duplicate.',
453
450
  '- Exception for the GitHub Actions deployment route: when the current task explicitly requests deployment, do not create a separate pre-push agent checkpoint. Commit and push the verified source; the Actions OIDC upload creates the single deployment checkpoint. Create an additional agent checkpoint only when the user explicitly asks to save a separate snapshot without deployment.',
454
- '- Saving is the default after meaningful work when MCP can complete it directly or the installed JoripSpace CLI absolute path is available. A local_upload_required checkpoint response must not block ordinary MCP work or direct deployment; use the installed CLI without requiring project-local Node.js. Do not enable, assume, or perform automatic deployment during initial onboarding.',
451
+ '- Saving is the default after meaningful work when MCP can complete it directly or the installed JoripSpace CLI absolute path is available. A local_upload_required checkpoint response must not block ordinary MCP work or direct deployment; use the installed CLI with its required runtime rather than generating project-local helpers. Do not enable, assume, or perform automatic deployment during initial onboarding.',
455
452
  '- Deploy the saved checkpoint only when the user explicitly asks to deploy the current change or explicitly asks for completed work to be deployed automatically. Without that request, stop after creating and verifying the checkpoint.',
456
453
  '- If tests or checks fail, do not deploy. A clearly labeled 작업 중 checkpoint may be created when preserving the current files is useful.',
457
454
  '- Documentation-only changes create a checkpoint but do not require a server deployment. Exception: a guide-refresh-only request updates managed guide/session files without creating a checkpoint.',
@@ -459,7 +456,7 @@ const CHECKPOINT_AGENT_RULE_LINES = [
459
456
  '- Treat local file restore and production rollback as separate confirmed actions. 이전 상태로 돌아가 means explain and confirm both independently.',
460
457
  '- 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.',
461
458
  '- 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.',
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.',
459
+ '- 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. Legacy .joripspace/*.mjs helpers are conditional compatibility only and are never required by new start onboarding. A verified build-and-CLI joripspace:deploy script remains supported for direct deployment.',
463
460
  ];
464
461
 
465
462
  const AFTER_CONNECTION_RULE_LINES = [
@@ -468,7 +465,7 @@ const AFTER_CONNECTION_RULE_LINES = [
468
465
  "- 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
466
  '- 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
467
  '- 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 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.',
468
+ '- Reuse existing valid CLI logins and authenticated MCP sessions without a new approval. New CLI connections use login --no-open --json: show approval_url from stderr, keep the process running, and follow the final stdout next_action/next_command. No code entry is required. For MCP initialize the transport, retain Mcp-Session-Id, and call start_login without arguments; show approval_url, then respect interval and call start_login with the returned request_id in the same session until connected. Continue with start_project_session without token arguments. Pending means wait; denial, expiry and errors must not switch flows or create duplicate approvals. Never request or expose a token; do not browse around or inspect browser storage. The server alone retains old code APIs for already released clients; current clients never fall back to a code flow.',
472
469
  '- 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
470
  '- 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
471
  '- If an MCP response includes workspace_setup.files, write those files into the current working folder immediately before replying.',
@@ -599,7 +596,7 @@ const REQUIRED_ONBOARDING_MARKERS = [
599
596
  'duplicate message ids and retried usage event ids are idempotent',
600
597
  'compatibility migration work is not a new message send',
601
598
  'installed JoripSpace CLI absolute path',
602
- 'Existing npm run joripspace:* scripts are conditional legacy compatibility only',
599
+ 'Legacy .joripspace/*.mjs helpers are conditional compatibility only',
603
600
  'one-line `.joripspace/project` slug',
604
601
  '<!-- joripspace:start -->',
605
602
  '<!-- joripspace:end -->',
@@ -692,7 +689,7 @@ function projectDeploymentRoutingLines(projectConfig = {}) {
692
689
  return [
693
690
  'Current deployment route: direct JoripSpace deployment.',
694
691
  '- A normal user request such as "배포해줘" is sufficient. Do not ask the user to choose GitHub or repeat deployment plumbing.',
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.',
692
+ '- 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. Reuse a verified build-and-CLI joripspace:deploy script for direct deployment. Old .joripspace/*.mjs helpers remain conditional legacy compatibility only.',
696
693
  '- Do not create a GitHub Actions workflow or push to GitHub solely to deploy while the project connection is absent, disconnected, invalid, or suspended.',
697
694
  ];
698
695
  }
@@ -701,7 +698,7 @@ function projectSecretManagementLines(projectConfig = {}) {
701
698
  const projectId = String(projectConfig.project_id || projectConfig.project_slug || '').trim();
702
699
  const encodedProjectId = projectId ? encodeURIComponent(projectId) : '{project_id}';
703
700
  return [
704
- `- Secret management link (always include this as a clickable Markdown link when an external provider credential is required): https://joripspace.com/projects/${encodedProjectId}/?tab=secrets`,
701
+ `- Secret value entry: use CLI secret list --name NAME --json or MCP list_secrets with name to get https://joripspace.com/projects/${encodedProjectId}/?tab=secrets&secret_name=NAME. Show the returned clickable link and key purpose; the user enters only the value. Do not create a random placeholder for a provider-issued key. Verify registration after confirmation, requiring a newer updated_at when replacing an existing key.`,
705
702
  ];
706
703
  }
707
704
 
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ function secretEntryName(value) {
4
+ const name = typeof value === 'string' ? value.toUpperCase() : '';
5
+ return /^[_A-Z][_A-Z0-9]{0,127}$/.test(name) &&
6
+ !['DB', 'STORAGE', 'PROJECT_ID'].includes(name) &&
7
+ !['JORIPSPACE_', 'CF_', 'CLOUDFLARE_'].some(prefix => name.startsWith(prefix)) ? name : '';
8
+ }
9
+
10
+ function secretManagementUrl(project, name = '') {
11
+ const base = `https://joripspace.com/projects/${encodeURIComponent(project)}/?tab=secrets`;
12
+ const selected = secretEntryName(name);
13
+ return selected ? `${base}&secret_name=${encodeURIComponent(selected)}` : base;
14
+ }
15
+
16
+ function secretEntryHandoff(project, name, secrets = []) {
17
+ const selected = secretEntryName(name);
18
+ if (!selected) return null;
19
+ const previous = secrets.find(secret => secret.name === selected && secret.status === 'active');
20
+ return {
21
+ project_id: project,
22
+ name: selected,
23
+ status: previous ? 'active' : 'not_registered',
24
+ operation: previous ? 'replace' : 'create',
25
+ previous_updated_at: previous?.updated_at || null,
26
+ next_action: previous ? 'verify_existing_secret_or_request_replacement_if_needed' : 'show_secret_management_url_then_wait_for_user',
27
+ verify_with: {
28
+ cli_args: ['secret', 'list', '--project', project, '--name', selected, '--json'],
29
+ mcp: { name: 'list_secrets', arguments: { project_id: project, name: selected } },
30
+ },
31
+ verification: previous
32
+ ? 'After the user confirms saving, list secrets again and require this name to be active with updated_at newer than previous_updated_at. Then run the relevant integration check.'
33
+ : 'After the user confirms saving, list secrets again and require this name to be active. Then run the relevant integration check.',
34
+ instruction: 'Show the clickable secret_management_url and explain the key purpose. The name is already filled in; the user enters only the value and saves. Do not generate a placeholder value, request the value in chat, or report registration complete before verification.',
35
+ };
36
+ }
37
+
38
+ module.exports = { secretEntryName, secretManagementUrl, secretEntryHandoff };