diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index efc448d..1786300 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,14 +4,17 @@ on: push: tags: - 'v*' + branches: + - develop permissions: id-token: write # Required for OIDC - contents: read + contents: write # Required for GitHub pre-releases jobs: - publish: - name: Publish to npm + publish-release: + name: Release (tag) + if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: @@ -40,4 +43,71 @@ jobs: run: pnpm run test - name: Publish to npm - run: npm publish + run: npm publish --access public + + publish-prerelease: + name: Pre-release (develop) + if: github.ref == 'refs/heads/develop' + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.28.0 + + - name: Use Node.js 24 + uses: actions/setup-node@v4 + with: + node-version: '24' + registry-url: 'https://registry.npmjs.org' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Configure Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Generate pre-release version + run: | + CURRENT_VERSION=$(node -p "require('./package.json').version") + SHORT_SHA=$(git rev-parse --short HEAD) + TIMESTAMP=$(date +%Y%m%d%H%M%S) + PRE_RELEASE_VERSION="${CURRENT_VERSION}-beta.${TIMESTAMP}.${SHORT_SHA}" + echo "Pre-release version: $PRE_RELEASE_VERSION" + echo "PRE_RELEASE_VERSION=$PRE_RELEASE_VERSION" >> "$GITHUB_ENV" + npm version "$PRE_RELEASE_VERSION" --no-git-tag-version + + - name: Build project + run: pnpm run build + + - name: Run tests + run: pnpm run test + + - name: Publish pre-release to npm + run: npm publish --tag beta --access public + + - name: Create GitHub pre-release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "v${PRE_RELEASE_VERSION}" \ + --title "Pre-release v${PRE_RELEASE_VERSION}" \ + --notes "Pre-release from develop branch. + + - Commit: ${{ github.sha }} + - Branch: ${{ github.ref_name }} + + Install with: + \`\`\`bash + npm install -g @hackmd/hackmd-cli@beta + \`\`\`" \ + --prerelease diff --git a/.gitignore b/.gitignore index fa25531..c74c0ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +package-lock.json *-debug.log *-error.log /.nyc_output diff --git a/CHANGELOG.md b/CHANGELOG.md index 342fd3d..7d9937d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to HackMD-CLI will be documented in this file. +## 2.5.0 + +### Added + +- Personal folder commands: `folders`, `folders create`, `folders update`, `folders delete`, and `folders order` +- Team folder commands: `team-folders`, `team-folders create`, `team-folders update`, `team-folders delete`, and `team-folders order` +- Agent skill (`hackmd-cli/SKILL.md`) with auto-packaging scripts for Cursor and other AI tooling + +### Changed + +- Upgraded `@hackmd/api` to v2.6.0 + +### Fixed + +- Folder update command now returns silently on success +- Folder command examples use hex color codes + ## 2.4.0 ### Added diff --git a/README.md b/README.md index c43264b..8ac1e55 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,13 @@ ## v2 notice -`hackmd-cli` v2 now only supports the official HackMD instance([hackmd.io](https://hackmd.io)) and HackMD EE instances after version `1.38.1`. CodiMD is not supported anymore. If you want to use the CLI tools with CodiMD, please check out the [`v1.x` README](https://github.com/hackmdio/hackmd-cli/tree/v1.2.0) and follow the instruction there. +`hackmd-cli` v2 now only supports the official HackMD instance ([hackmd.io](https://hackmd.io)) and HackMD EE instances after version `1.38.1`. CodiMD is not supported in this package. + +**CodiMD users:** A dedicated standalone CLI is now available at [hackmdio/codimd-cli](https://github.com/hackmdio/codimd-cli). Please refer to that repository for installation and usage instructions. ### Migrating from v1.x -1. If you are using the CLI with CodiMD, please follow the [`v1.x` README](https://github.com/hackmdio/hackmd-cli/tree/v1.2.0) +1. If you are using the CLI with CodiMD, please use the standalone [codimd-cli](https://github.com/hackmdio/codimd-cli) instead. 2. If you are using the CLI with HackMD([hackmd.io](https://hackmd.io)) or HackMD EE(Enterprise Edition) instances: * **You're using the JSON file-based config**: Remove `~/.hackmd/config.json` and start over again. You can start with [configuration](#configuration) section. * **You're using environment variable based config**: `HMD_CLI_SERVER_URL` has been replaced with `HMD_API_ENDPOINT_URL`. And `HMD_API_ENDPOINT_URL` may vary depending on your instance. Please check contact your instance admin to get the correct `HMD_API_ENDPOINT_URL`. For generating access token, please check the [configuration](#configuration) section. You'll need to set the `HMD_API_ACCESS_TOKEN` environment variable. @@ -29,7 +31,7 @@ $ npm install -g @hackmd/hackmd-cli $ hackmd-cli COMMAND running command... $ hackmd-cli (--version|-v) -@hackmd/hackmd-cli/2.4.0 darwin-arm64 node-v24.13.0 +@hackmd/hackmd-cli/2.5.0 darwin-arm64 node-v26.0.0 $ hackmd-cli --help [COMMAND] USAGE $ hackmd-cli COMMAND @@ -100,6 +102,11 @@ All available configurations are listed in the table below. * [`hackmd-cli autocomplete [SHELL]`](#hackmd-cli-autocomplete-shell) * [`hackmd-cli export`](#hackmd-cli-export) +* [`hackmd-cli folders`](#hackmd-cli-folders) +* [`hackmd-cli folders create`](#hackmd-cli-folders-create) +* [`hackmd-cli folders delete`](#hackmd-cli-folders-delete) +* [`hackmd-cli folders order`](#hackmd-cli-folders-order) +* [`hackmd-cli folders update`](#hackmd-cli-folders-update) * [`hackmd-cli help [COMMANDS]`](#hackmd-cli-help-commands) * [`hackmd-cli history`](#hackmd-cli-history) * [`hackmd-cli login`](#hackmd-cli-login) @@ -108,6 +115,11 @@ All available configurations are listed in the table below. * [`hackmd-cli notes create`](#hackmd-cli-notes-create) * [`hackmd-cli notes delete`](#hackmd-cli-notes-delete) * [`hackmd-cli notes update`](#hackmd-cli-notes-update) +* [`hackmd-cli team-folders`](#hackmd-cli-team-folders) +* [`hackmd-cli team-folders create`](#hackmd-cli-team-folders-create) +* [`hackmd-cli team-folders delete`](#hackmd-cli-team-folders-delete) +* [`hackmd-cli team-folders order`](#hackmd-cli-team-folders-order) +* [`hackmd-cli team-folders update`](#hackmd-cli-team-folders-update) * [`hackmd-cli team-notes`](#hackmd-cli-team-notes) * [`hackmd-cli team-notes create`](#hackmd-cli-team-notes-create) * [`hackmd-cli team-notes delete`](#hackmd-cli-team-notes-delete) @@ -167,7 +179,143 @@ EXAMPLES # A note to be exported ``` -_See code: [src/commands/export.ts](https://github.com/hackmdio/hackmd-cli/blob/v2.4.0/src/commands/export.ts)_ +_See code: [src/commands/export.ts](https://github.com/hackmdio/hackmd-cli/blob/v2.5.0/src/commands/export.ts)_ + +## `hackmd-cli folders` + +HackMD folders commands + +``` +USAGE + $ hackmd-cli folders [--folderId ] [-h] [--columns | -x] [--sort ] [--filter ] + [--output csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ] + +FLAGS + -h, --help Show CLI help. + -x, --extended show extra columns + --columns= only show provided columns (comma-separated) + --csv output is csv format [alias: --output=csv] + --filter= filter property by partial string matching, ex: name=foo + --folderId= HackMD folder id + --no-header hide table header from output + --no-truncate do not truncate output to fit screen + --output=