hackathon-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJoin the hackathon
加入黑客松
The CLI does the deterministic work and prints every command it runs on stderr. This skill
only sequences the commands and reads their answers. It holds no credential: the participant's own
Antasphere login and their own GitHub access do the work.
hackathonPass to every command and read the answer on stdout. A refusal is
with an exit code (the table at the end). Where a step
says ASK, ask the participant and wait: never guess their email, their GitHub username or their folder.
--jsonhackathon{ "ok": false, "error": { "code", "message" } }hackathon给每条 命令传入 ,并从 stdout 读取结果。请求被拒绝时,结果为 ,并带有退出码(见文末表格)。凡是步骤中标注 ASK 的地方,都要询问参与者并等待:绝不猜测其邮箱地址、GitHub 用户名或文件夹。
hackathon--json{ "ok": false, "error": { "code", "message" } }1. Node.js, then the CLI
1. Node.js,然后是 CLI
The CLI installs through npm, so Node.js comes first:
bash
node --versionNo Node.js, or a version below 22: point to https://nodejs.org (version 22 or later) and stop until it
is installed. Then:
bash
npm i -g @antasphere/hackathon@latest
hackathon --versionThis skill needs version 0.7.1 or later (the one-command Antasphere sign-in and ). An older
version prints a help that talks about "an existing hck_ API key": then the event's CLI is not
published yet. Say so and stop; an organizer has to publish it.
decks linkloginCLI 通过 npm 安装,因此需要先安装 Node.js:
bash
node --version如果没有 Node.js,或版本低于 22:指向 https://nodejs.org(要求版本 22 或更高),并停止操作,直到安装完成。然后运行:
bash
npm i -g @antasphere/hackathon@latest
hackathon --version本 skill 需要 0.7.1 或更高版本(该版本支持一步完成 Antasphere 登录和 )。如果旧版本输出的 帮助中提到“现有的 hck_ API key”,说明本次活动的 CLI 尚未发布。告知参与者并停止操作;需要由组织者发布。
decks linklogin2. The machine, before the sign-in
2. 登录前检查机器
Check the machine now, so nothing about it surprises the participant after the sign-in and the clone:
bash
hackathon doctor --jsonIt changes nothing. Read (). At this point only the machine
checks must pass: , , , , , and
(class ). For each one with false, show its and walk the participant through it
on their system (: is macOS, , is Windows), the way the
skill does (: ask the name and email they want on their commits, then
and ; Docker Desktop
not running is the usual one). Run the doctor again after each fix, until every machine check passes.
checks{ name, ok, detail, fix?, cls? }gitgit identitynodedockerdocker daemondocker composediskenvironmentokfixplatformdarwinlinuxwin32hackathon-doctorgit identitygit config --global user.name "<name>"git config --global user.email "<email>"Every other check is expected to fail here, since nobody is signed in and nothing is cloned yet:
, , , , , , , ,
, . Ignore them now; the steps below settle them, and the final doctor run proves it.
Ignore the exit code at this step too: it reflects those checks.
instancecredentialrosterrepositorygithub accessdirectorypushinstallerappmanifest现在检查机器,避免登录和克隆之后才出现意外:
bash
hackathon doctor --json该命令不会进行任何更改。读取 ()。此时只有机器环境检查项必须通过:、、、、、 和 (类别为 )。对于每个 为 false 的检查项,展示其 ,并按照 skill 的方式,引导参与者在自己的系统上完成修复(: 是 macOS, 是 Linux, 是 Windows)(:询问他们希望用于提交的姓名和邮箱地址,然后运行 和 ;最常见的问题是 Docker Desktop 未运行)。每次修复后重新运行 doctor,直到所有机器环境检查项都通过。
checks{ name, ok, detail, fix?, cls? }gitgit identitynodedockerdocker daemondocker composediskenvironmentokfixhackathon-doctorplatformdarwinlinuxwin32git identitygit config --global user.name "<name>"git config --global user.email "<email>"此时,其他所有检查项都预期会失败,因为尚未登录,也尚未克隆任何内容:、、、、、、、、、。现在忽略这些检查项;后续步骤会解决它们,而最后一次 doctor 运行将证明一切正常。此时也要忽略退出码:它反映的正是这些检查项。
instancecredentialrosterrepositorygithub accessdirectorypushinstallerappmanifest3. Sign in (once per machine)
3. 登录(每台机器一次)
bash
hackathon connect --json- Exit 0: signed in already, go to step 4 with this answer.
- Exit 3 saying to run : sign the participant in, in two commands. ASK their email: "Which email address have you been using with Antasphere? It is the one our emails, your invitation and the briefing call were sent to." Never guess it. Then say a code is on its way and run
hackathon login. When they paste the code, runhackathon login --email <email> --send-only; it printshackathon login --email <email> --code <code>. A refused code has expired: send a new one withSigned in as …. (A CLI older than 0.8.1 has no--send-only: run--send-onlyand pass the code on its standard input.) Then runhackathon login --email <email>again.hackathon connect --json - "This account has no access to Antasphere Hackathon in any of its organizations" (exit 3): not fixable here. The organizers must add the participant's email to the event. Say so and stop.
- (exit 3): the email signed in is not the one on the roster. If the participant used another email, run
not_on_roster(it forgets the stored Antasphere login), then sign in again, as above, with the email on the roster. Otherwise an organizer adds them; stop.npx @antasphere/cli logout - (exit 3): the event is not open yet. Stop and say to try again later.
event_not_configured
Only for an instance an organizer named explicitly (not the cloud): ,
then .
hackathon login --api-url <url>hackathon connect --api-url <url> --jsoneligibility.eligiblebash
hackathon connect --json- 退出码 0:已经登录,直接使用此结果进入第 4 步。
- 退出码 3,并提示运行 :使用两条命令让参与者登录。ASK 其邮箱地址:“你一直使用哪个邮箱地址登录 Antasphere?我们的邮件、你的邀请和说明电话会议都发送到了这个地址。”绝不猜测。然后告知验证码正在发送,并运行
hackathon login。参与者粘贴验证码后,运行hackathon login --email <email> --send-only;它会输出hackathon login --email <email> --code <code>。如果验证码被拒绝,说明验证码已过期:使用Signed in as …重新发送一个。(低于 0.8.1 的 CLI 没有--send-only:运行--send-only,并通过标准输入传入验证码。)然后再次运行hackathon login --email <email>。hackathon connect --json - 出现“该账户在其任何组织中都没有 Antasphere Hackathon 访问权限”(退出码 3):此处无法修复。组织者必须将参与者的邮箱添加到活动中。告知参与者并停止操作。
- (退出码 3):登录所用的邮箱不是名册中的邮箱。如果参与者使用了另一个邮箱,运行
not_on_roster(这会清除已保存的 Antasphere 登录信息),然后按照上述步骤使用名册中的邮箱重新登录。否则需要由组织者添加参与者;停止操作。npx @antasphere/cli logout - (退出码 3):活动尚未开放。停止操作,并告知参与者稍后再试。
event_not_configured
仅当组织者明确指定了某个 instance(而非云端 instance)时,才运行:
bash
hackathon login --api-url <url>
hackathon connect --api-url <url> --json如果结果中的 为 false(参赛者是组织者、教练、评审团成员,或尚未加入团队的参与者),则没有需要设置的团队应用。说明原因并停止操作。
eligibility.eligible4. GitHub access
4. GitHub 访问权限
Read in the connect answer. is : the organizers have not
created the team repositories yet. Stop and say to come back later. When it is , read
:
repositoryrepository.statependingassignedrepository.access- is
standing: ASK the participant's GitHub username, thenno_usernameand readhackathon connect --github <username> --jsonagain.repository.accessmeans another person on the roster named it: ask again, or an organizer fixes it.github_login_taken - is
standing: ask the participant to openinvited, signed in to GitHub asrepository.access.invitationUrl, and accept. Wait for their word, thenrepository.access.githubagain.hackathon connect --json - is
standing, ornonewithmemberfalse: showcanPush. An organizer has to act. Stop.repository.access.fix - true, or
canPushstanding(GitHub did not answer): go on.unknown
读取 connect 结果中的 。如果 为 ,说明组织者尚未创建团队仓库。停止操作,并告知参与者稍后再来。如果为 ,则读取 :
repositoryrepository.statependingassignedrepository.access- 为
standing:ASK 参与者的 GitHub 用户名,然后运行no_username,并再次读取hackathon connect --github <username> --json。如果出现repository.access,说明名册中的另一人使用了该用户名:让参与者重新输入,或由组织者修复。github_login_taken - 为
standing:让参与者打开invited,确保其登录的 GitHub 账号是repository.access.invitationUrl,然后接受邀请。等待参与者确认后,再次运行repository.access.github。hackathon connect --json - 为
standing,或者none的member为 false:展示canPush。需要由组织者处理。停止操作。repository.access.fix - 为 true,或者
canPush为standing(GitHub 未返回结果):继续下一步。unknown
5. Clone and set up
5. 克隆和设置
ASK where the repository should go, and propose from the connect answer
(). With another folder, pass to every command
below.
defaultDirectory~/Antasphere/hackathon/<team>--directory <path>First clone without starting, because a team app usually needs its environment file first:
bash
hackathon setup --no-start --json # or: --directory <path>The CLI checks the GitHub access, Git, Docker, the daemon and Compose, clones the repository (or keeps
an existing correct clone with its local changes) and writes the agent files. Exit 4 names what to
install or start (Docker Desktop not running is the usual one): relay the sentence, let the
participant do it, run the same command again. Exit 5: the folder is not empty and is not the clone;
ASK another folder, never delete anything.
The environment file. If the clone has a and no : copy it to , fill
every password or secret line that the app generates itself (for example
and with ), and . Leave every
third-party API key empty and tell the participant which ones to paste into themselves (the
event's page says where each key comes from). Never ask them to paste a key into the chat, and never
print . An empty key does not stop the app; they can add it later and restart.
.env.example.env.envPOSTGRES_PASSWORDAUTH_SECRETopenssl rand -hex 16chmod 600 .env.env.envThen start:
bash
hackathon setup --json # same --directory if one was chosenIt builds and starts the app from the repository's and waits for the readiness probe.
null in the answer means the repository has no yet: nothing to start, which is
fine. Exit 4 "not ready in time": run the command it printed and read the
error with the participant.
hackathon.jsonapphackathon.jsondocker compose … logsASK 仓库应放置在哪个位置,并提出 connect 结果中的 ()作为建议。如果选择其他文件夹,则向下面的每条命令传入 。
defaultDirectory~/Antasphere/hackathon/<team>--directory <path>先只克隆而不启动,因为团队应用通常需要先准备环境文件:
bash
hackathon setup --no-start --json # or: --directory <path>CLI 会检查 GitHub 访问权限、Git、Docker、daemon 和 Compose,克隆仓库(或保留已有且正确、包含本地更改的 clone),并写入 agent 文件。退出码 4 会指出需要安装或启动的内容(最常见的是 Docker Desktop 未运行):转述相应提示,让参与者亲自处理,然后重新运行同一条命令。退出码 5:文件夹非空,且不是指定的 clone;ASK 参与者改用其他文件夹,绝不删除任何内容。
环境文件。 如果 clone 中存在 ,但不存在 :将其复制为 ,填写应用自行生成所需的每个 password 或 secret 项(例如使用 生成 和 ),并执行 。所有第三方 API key 均保持为空,并告知参与者需要自行粘贴到 中的具体项目(活动页面会说明每个 key 的来源)。绝不要让参与者把 key 粘贴到聊天中,也绝不要打印 。空的 key 不会阻止应用运行;参与者之后可以补充并重启应用。
.env.example.env.envopenssl rand -hex 16POSTGRES_PASSWORDAUTH_SECRETchmod 600 .env.env.env然后启动:
bash
hackathon setup --json # same --directory if one is chosen该命令根据仓库中的 构建并启动应用,同时等待就绪探测完成。如果结果中的 为 null,说明仓库中还没有 ,因此没有需要启动的内容,这是正常情况。退出码 4 且提示“未在规定时间内就绪”:运行它输出的 命令,并与参与者一起查看错误。
hackathon.jsonapphackathon.jsondocker compose … logs6. Open it
6. 打开应用
Open the local app () and the platform's dashboard () from the setup answer
( on macOS, on
Linux, on Windows). If the app asks to claim the instance on the first boot, the setup token is
in its log: , run from the clone.
app.urldashboardUrlopen <url>xdg-openstartdocker compose -p hackathon-<team> logs app | grep 'claim the instance'使用 setup 结果中的本地应用地址()和平台 dashboard 地址()打开页面(macOS 使用 ,Linux 使用 ,Windows 使用 )。如果应用首次启动时要求认领 instance,setup token 会出现在日志中:在 clone 目录中运行 。
app.urldashboardUrlopen <url>xdg-openstartdocker compose -p hackathon-<team> logs app | grep 'claim the instance'7. The team's project description
7. 团队的项目描述
Right after the app runs, give the team its one line: each team is a project of the event, and its
description is what the organizers, the coaches and the jury read about it. Take the project from
(), then follow section 5 of the skill ("The
team's project description"): ASK in one question what they are building (the problem, for whom, the
approach), propose a crisp description, and on their OK set it, or, as a participant is an editor
of their project and only a manager may change it, open the request for an
organizer with the agreed text. If they do not know yet, say it can wait and the skill will ask
again.
hackathon event status --jsonme.project.idhackathon-doctorProject descriptionhackathon-doctor应用运行后,紧接着为团队提供一句话描述:每个团队都是本次活动中的一个项目,其描述是组织者、教练和评审团了解该项目时阅读的内容。从 的结果中获取项目(),然后遵循 skill 第 5 节(“团队的项目描述”):用一个问题询问他们正在构建什么(要解决什么问题、面向谁、采用什么方法),提出一段简洁明了的描述,并在他们确认后进行设置;或者,如果参与者只是其项目的 editor,而只有 manager 可以修改,则使用约定好的文本为组织者发起 请求。如果他们暂时还不知道,说明可以稍后处理, skill 会再次询问。
hackathon event status --jsonme.project.idhackathon-doctorProject descriptionhackathon-doctor8. The clock and the pacing
8. 时间节点和推进节奏
Read and tell the participant the phase, the time left to the build
end and to the freeze (the build end plus 15 minutes) in the event's time zone, and the rule: what
counts is the last push to the designated branch ( in the
team's line) that the platform received before the freeze; there is nothing to click. From here,
the pacing of the skill section 6 holds: push small and often (at least every 30 to 45 minutes)
and confirm the receipt, warnings at 60, 30 and 15 minutes before the build end, only fixes in the
grace, the skill before the end.
hackathon event status --jsonsubmission.repository.designatedBranchhackathon-doctorhackathon-deck-demoThen run the doctor a last time, from the clone, to prove the whole setup:
bash
hackathon doctor --directory <clone> --jsonEvery check must pass now. For any that fails, show its and settle it as the
skill does, then run it again until it exits 0.
fixhackathon-doctorFinish with one short summary: who they are, their team, the clone's folder, the local URL, the
dashboard URL, the deadlines, and the two next skills: the skill at the start of every working
session (the clock, the setup, the push), the skill when the demo deck is due.
hackathon-doctorhackathon-deck-demo读取 ,并告知参与者当前阶段、距离构建结束和冻结(构建结束后 15 分钟)还剩多长时间,以及活动所在时区。规则是:以平台在冻结前收到的、对指定分支(团队信息中的 )的最后一次 push 为准;无需点击任何按钮。从现在起,遵循 skill 第 6 节的节奏:小步、频繁地 push(至少每 30 至 45 分钟一次),并确认平台已经收到;在构建结束前 60、30 和 15 分钟时发出提醒;宽限期内只进行修复;在结束前使用 skill。
hackathon event status --jsonsubmission.repository.designatedBranchhackathon-doctorhackathon-deck-demo然后从 clone 目录最后运行一次 doctor,以证明整个设置已成功:
bash
hackathon doctor --directory <clone> --json现在每个检查项都必须通过。对于任何失败的检查项,展示其 ,并按照 skill 的方式解决,然后重新运行,直到退出码为 0。
fixhackathon-doctor最后给出一段简短总结:参与者是谁、所属团队、clone 的文件夹、本地 URL、dashboard URL、截止时间,以及接下来要使用的两个 skill:每次开始工作时使用 skill(查看时间节点、检查设置、执行 push),演示 deck 到期时使用 skill。
hackathon-doctorhackathon-deck-demoExit codes
退出码
- 0: done. Read the JSON.
- 2: a flag is missing or wrong. Read the usage the CLI printed.
- 3: access: a sign-in to do, not on the roster, no event yet, no team or repository yet, no push access on GitHub, or GitHub refused. The message says who to ask or what to run. Never retry in a loop: the state has to change first.
- 4: the machine: Git, its identity, Node.js, Docker, the daemon or Compose; the disk; the port taken; the app not ready. The message says what to install, start or free.
- 5: the folder is not empty and is not the assigned clone.
- 0:已完成。读取 JSON。
- 2:缺少参数或参数错误。读取 CLI 输出的用法说明。
- 3:访问权限问题:需要登录、不在名册中、活动尚未开放、尚无团队或仓库、GitHub 上没有 push 权限,或者 GitHub 拒绝请求。错误消息会说明应联系谁或应运行什么命令。绝不能循环重试:必须先让状态发生变化。
- 4:机器环境问题:Git、Git identity、Node.js、Docker、daemon 或 Compose、磁盘空间、端口被占用、应用未就绪。错误消息会说明需要安装、启动或释放什么。
- 5:文件夹非空,且不是指定的 clone。
Never
绝不执行
- Never pass a credential to the CLI: no GitHub token, no API key, no hub secret. It needs none.
- Never run a command that needs the participant's password () or their GitHub sign-in (
sudo) for them: show it and let them run it.gh auth login - Never edit the clone's remote URL, never , never delete the clone to make a setup pass: run
git reset --hardagain, it resumes.hackathon setup - Never run a real to test access:
git pushproves it with a dry run.hackathon doctor
- 绝不向 CLI 传入任何凭据:不要传 GitHub token、API key 或 hub secret。它不需要这些凭据。
- 绝不要代替参与者运行需要其 password()或 GitHub 登录(
sudo)的命令:展示命令并让参与者亲自运行。gh auth login - 绝不修改 clone 的 remote URL,绝不执行 ,也绝不删除 clone 来让设置通过:重新运行
git reset --hard即可恢复。hackathon setup - 绝不要运行真实的 来测试访问权限:
git push会通过 dry run 进行验证。hackathon doctor