Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ The [Poki for Developers](https://developers.poki.com/) CLI is designed primaril

## Install

Node.js 20.7 or newer is required. This preview is published on npm's opt-in `experimental` channel; an unqualified `@poki/cli` install follows the stable `latest` channel instead. Choose one persistent [npm installation mode](https://docs.npmjs.com/cli/install/).
Node.js 20.7 or newer is required. Choose one persistent [npm installation mode](https://docs.npmjs.com/cli/install/).

Install globally when the CLI should be available to the current user in every project:

```sh
npm install --global --ignore-scripts @poki/cli@experimental
npm install --global --ignore-scripts @poki/cli
poki --version
```

Expand All @@ -22,18 +22,18 @@ Invoke this installation as `poki`.
Install as a project-local development dependency when the project should pin and share its CLI version:

```sh
npm install --save-dev --ignore-scripts @poki/cli@experimental
npx @poki/cli@experimental --version
npm install --save-dev --ignore-scripts @poki/cli
npx @poki/cli --version
```

Invoke this installation as `npx @poki/cli@experimental`. Installing or updating this mode modifies the project's `package.json` and npm lockfile, so review and commit those changes with the project.
Invoke this installation as `npx @poki/cli`. Installing or updating this mode modifies the project's `package.json` and npm lockfile, so review and commit those changes with the project.

## Configure the project

From the game project directory, run:

```sh
npx @poki/cli@experimental init --game GAME_ID --build-dir dist
npx @poki/cli init --game GAME_ID --build-dir dist
```

`GAME_ID` is the game ID shown on its Poki for Developers page. `build-dir` is the directory containing the built game. This creates `poki.json`:
Expand Down Expand Up @@ -67,7 +67,7 @@ The developer must authenticate explicitly once, manually, in their own terminal
Without a project-local dependency, the developer can run:

```sh
npx @poki/cli@experimental auth login
npx @poki/cli auth login
```

If `@poki/cli` is already installed as a project dependency, the developer can run its `poki` binary from that project:
Expand Down Expand Up @@ -95,7 +95,7 @@ No other command, option, normalized response shape, or workflow has a future cr
After setup, the LLM should start by running:

```sh
npx @poki/cli@experimental
npx @poki/cli
```

The resulting structured help explains how to discover and use every supported command. This README intentionally does not duplicate that LLM-facing documentation.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poki/cli",
"version": "0.2.0-exp.5",
"version": "0.2.0",
"description": "Poki for Developers command line utility",
"keywords": [
"cli",
Expand Down
2 changes: 1 addition & 1 deletion scripts/release-tag.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function validatePublishTag (version, publishArguments) {
throw new Error(`Invalid npm dist-tag '${tag}'; use a lowercase tag beginning with a letter and containing only letters, digits, dot, underscore, or hyphen.`)
}
if (tag !== undefined && semver.validRange(tag) !== null) {
throw new Error(`Invalid npm dist-tag '${tag}'; npm dist-tags cannot be valid semantic-version ranges. Use a channel name such as 'experimental'.`)
throw new Error(`Invalid npm dist-tag '${tag}'; npm dist-tags cannot be valid semantic-version ranges. Use a channel name such as 'rc'.`)
}
if (prerelease && tag === undefined) {
throw new Error('A prerelease package version requires one explicit non-latest --tag.')
Expand Down
4 changes: 2 additions & 2 deletions src/docs/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ export function updatesDocument (): Record<string, unknown> {
cadence: 'Before the first eligible Poki API request, at most one registry lookup is attempted per rolling 24 hours for the shared user config directory. A failed attempt also starts the 24-hour suppression window.',
registry_command: 'npm view @poki/cli "dist-tags.latest" --json',
boundary: 'npm runs without a shell, with a 5-second timeout and bounded output. Lookup, timeout, parse, filesystem, and npm failures are silent and never affect the original command.',
channel: 'Only the stable latest dist-tag is compared. Equal, older, invalid, and prerelease latest values produce no notice; installations opted into @experimental still refresh experiments manually.',
channel: 'Only the stable latest dist-tag is compared. Equal, older, invalid, and prerelease latest values produce no notice.',
eligible: 'Ordinary authenticated Poki API commands are eligible. The lookup finishes before their first real API request.',
excluded: 'Help, version, auth commands, legacy upload, Inspector uploads, context, bundled audiences, ordinary mutation --dry-run, and analytics --validate-only do not perform update network or state work. A dry-run explicitly documented as reading current API state is eligible.'
},
Expand Down Expand Up @@ -901,7 +901,7 @@ export const helpTopics: HelpTopic[] = [
{ name: 'permissions', summary: 'Developer permission codes, descriptions, command mappings, scope, and denial behavior.', keywords: ['permission', 'permissions', 'access', 'forbidden', 'denied', 'developer-support', 'ownership', 'scope', 'whoami'], document: permissionsDocument },
{ name: 'shapes', summary: 'Response envelopes, list views, pagination meta, dry-run documents, and the error contract.', keywords: ['output', 'shape', 'envelope', 'meta', 'pagination', 'has_next', 'view', 'error', 'stderr', 'exit code', 'retryable', 'retry_after', 'request_id', 'dry-run'], document: shapesDocument },
{ name: 'workflows', summary: 'End-to-end preview, release, polling, discovery, and reporting flows with rollback guidance.', keywords: ['workflow', 'preview', 'browser', 'play', 'release', 'publish', 'poll', 'polling', 'wait', 'rollback', 'review', 'activate', 'report', 'timezone', 'rate limit', 'team id', 'game id'], document: workflowsDocument },
{ name: 'updates', summary: 'Stable daily update checks, shared state, stderr advisory shape, npm actions, and opt-out.', keywords: ['update', 'upgrade', 'npm', 'latest', 'experimental', 'dist-tag', 'stderr', 'POKI_CLI_UPDATE_CHECK'], document: updatesDocument }
{ name: 'updates', summary: 'Stable daily update checks, shared state, stderr advisory shape, npm actions, and opt-out.', keywords: ['update', 'upgrade', 'npm', 'latest', 'dist-tag', 'stderr', 'POKI_CLI_UPDATE_CHECK'], document: updatesDocument }
]

export function helpTopicDocument (name: string): Record<string, unknown> | undefined {
Expand Down
38 changes: 19 additions & 19 deletions test/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,20 @@ void test('prerelease publication requires one explicit npm-valid non-latest dis
const probe = `
import { validatePublishTag } from ${JSON.stringify(moduleUrl)}
const cases = ${JSON.stringify([
['0.2.0-experimental.0', [], false],
['0.2.0-experimental.0', ['--tag', 'latest'], false],
['0.2.0-experimental.0', ['--tag'], false],
['0.2.0-experimental.0', ['--tag='], false],
['0.2.0-experimental.0', ['--tag', 'experimental', '--tag', 'next'], false],
['0.2.0-experimental.0', ['-t', 'experimental'], false],
['0.2.0-experimental.0', ['--tag', 'v0.2.0-exp.0'], false],
['0.2.0-experimental.0', ['--tag', 'x'], false],
['0.2.0-experimental.0', ['--tag', 'experimental'], true],
['0.2.0-experimental.0', ['--tag', 'exp-0.2.0'], true],
['0.2.0-experimental.1', ['--tag=experimental'], true],
['0.2.0-rc.0', [], false],
['0.2.0-rc.0', ['--tag', 'latest'], false],
['0.2.0-rc.0', ['--tag'], false],
['0.2.0-rc.0', ['--tag='], false],
['0.2.0-rc.0', ['--tag', 'rc', '--tag', 'next'], false],
['0.2.0-rc.0', ['-t', 'rc'], false],
['0.2.0-rc.0', ['--tag', 'v0.2.0-rc.0'], false],
['0.2.0-rc.0', ['--tag', 'x'], false],
['0.2.0-rc.0', ['--tag', 'rc'], true],
['0.2.0-rc.0', ['--tag', 'rc-0.2.0'], true],
['0.2.0-rc.1', ['--tag=rc'], true],
['0.2.0', [], true],
['0.2.0', ['--tag', 'latest'], true],
['0.2.0', ['--tag', 'experimental'], true]
['0.2.0', ['--tag', 'rc'], true]
])}
const results = cases.map(([version, args, expected]) => {
let accepted = true
Expand Down Expand Up @@ -114,14 +114,14 @@ void test('publication explicitly owns latest and dry-run instead of inheriting
resolveReleasePublishArguments('0.2.0', ['--dry-run']),
resolveReleasePublishArguments('0.2.0', ['--dry-run=false']),
resolveReleasePublishArguments('0.2.0', ['--tag', 'next']),
resolveReleasePublishArguments('0.2.0-experimental.0', ['--tag=experimental'])
resolveReleasePublishArguments('0.2.0-rc.0', ['--tag=rc'])
]
process.stdout.write(JSON.stringify({ resolved, dryRuns: resolved.map(releasePublishIsDryRun) }))
`
const result = spawnSync(process.execPath, ['--input-type=module', '--eval', probe], {
cwd: repository,
encoding: 'utf8',
env: { ...process.env, NPM_CONFIG_DRY_RUN: 'true', NPM_CONFIG_TAG: 'experimental' }
env: { ...process.env, NPM_CONFIG_DRY_RUN: 'true', NPM_CONFIG_TAG: 'rc' }
})
assert.equal(result.status, 0, result.stderr)
assert.deepEqual(JSON.parse(result.stdout), {
Expand All @@ -130,7 +130,7 @@ void test('publication explicitly owns latest and dry-run instead of inheriting
['--dry-run', '--tag', 'latest'],
['--dry-run=false', '--tag', 'latest'],
['--tag', 'next', '--dry-run=false'],
['--tag=experimental', '--dry-run=false']
['--tag=rc', '--dry-run=false']
],
dryRuns: [false, true, false, false, false]
})
Expand All @@ -141,17 +141,17 @@ void test('release Git tagging preflights without mutation, then creates and pus
const moduleUrl = pathToFileURL(join(repository, 'scripts', 'release-git-tag.mjs')).href
const { prepareReleaseGitTag, publishReleaseGitTag } = await import(moduleUrl)

const plan = withoutAlternateGitIndex(() => prepareReleaseGitTag(worktree, '0.2.0-experimental.0'))
assert.equal(plan.tag, 'v0.2.0-experimental.0')
const plan = withoutAlternateGitIndex(() => prepareReleaseGitTag(worktree, '0.2.0-rc.0'))
assert.equal(plan.tag, 'v0.2.0-rc.0')
assert.equal(plan.commit, commit)
assert.equal(spawnSync('git', ['show-ref', '--verify', '--quiet', plan.reference], { cwd: worktree }).status, 1)

withoutAlternateGitIndex(() => publishReleaseGitTag(plan))
assert.equal(runGit(worktree, ['rev-parse', plan.reference]), commit)
assert.equal(runGit(worktree, ['--git-dir', remote, 'rev-parse', plan.reference]), commit)
assert.throws(() => withoutAlternateGitIndex(() => prepareReleaseGitTag(worktree, '0.2.0-experimental.0')), /already exists locally/)
assert.throws(() => withoutAlternateGitIndex(() => prepareReleaseGitTag(worktree, '0.2.0-rc.0')), /already exists locally/)
runGit(worktree, ['update-ref', '-d', plan.reference])
assert.throws(() => withoutAlternateGitIndex(() => prepareReleaseGitTag(worktree, '0.2.0-experimental.0')), /already exists on 'origin'/)
assert.throws(() => withoutAlternateGitIndex(() => prepareReleaseGitTag(worktree, '0.2.0-rc.0')), /already exists on 'origin'/)
})

void test('release Git tagging refuses uncommitted index bytes', async t => {
Expand Down
8 changes: 4 additions & 4 deletions test/update.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ void test('semantic version comparison accepts stable and prerelease precedence
assert.equal(compareSemver('1.0.0', '1.0.0'), 0)
assert.equal(compareSemver('1.0.0-alpha.1', '1.0.0-alpha.2'), -1)
assert.equal(compareSemver('1.0.0-alpha.2', '1.0.0-alpha.beta'), -1)
assert.equal(compareSemver('1.0.0-experimental.9', '1.0.0'), -1)
assert.equal(compareSemver('1.0.0-rc.9', '1.0.0'), -1)
assert.equal(compareSemver('2.0.0', '1.999.999'), 1)
assert.equal(compareSemver('1.0.0+build.1', '1.0.0+build.2'), 0)
assert.equal(compareSemver('1.0', '1.0.0'), undefined)
assert.equal(compareSemver('1.0.0-01', '1.0.0'), undefined)

assert.equal(stableUpdateAvailable('1.0.0', '1.0.1'), true)
assert.equal(stableUpdateAvailable('1.0.0-experimental.0', '1.0.0'), true)
assert.equal(stableUpdateAvailable('1.0.0-experimental.0', '0.9.0'), false)
assert.equal(stableUpdateAvailable('1.0.0', '1.1.0-experimental.0'), false)
assert.equal(stableUpdateAvailable('1.0.0-rc.0', '1.0.0'), true)
assert.equal(stableUpdateAvailable('1.0.0-rc.0', '0.9.0'), false)
assert.equal(stableUpdateAvailable('1.0.0', '1.1.0-rc.0'), false)
assert.equal(stableUpdateAvailable('1.0.0', '1.0.0'), false)
assert.equal(stableUpdateAvailable('1.0.1', '1.0.0'), false)
assert.equal(stableUpdateAvailable('not-semver', '1.0.0'), false)
Expand Down
Loading