plankit-cli 1.0.0 → 1.2.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/README.md CHANGED
@@ -1,71 +1,118 @@
1
1
  # `plankit` — AI Coding Agent Workflow Command Suite
2
2
 
3
- > [!IMPORTANT]
4
- > **PlanKit CLI** is a lightweight, zero-dependency command-line tool that installs the **PlanKit Command Suite** (`plankit.plan`, `plankit.clarify`, `plankit.implement`, `plankit.review`) into any project. Works seamlessly with **Google Antigravity**, **OpenCode**, **Codex**, **Cursor**, and **Claude Code**.
3
+ PlanKit is a lightweight, zero-dependency CLI that installs and manages a multi-phase feature workflow for AI coding assistants.
5
4
 
6
- ---
5
+ It creates a predictable artifact structure, agent instruction files, phase specs, phase output reports, and archive records.
7
6
 
8
- ## Quick Start (Usage without installation)
9
-
10
- Run in any project directory:
7
+ ## Quick start
11
8
 
12
9
  ```bash
13
10
  npx plankit-cli init
11
+ npx plankit-cli plan my-feature "Add configurable templates"
14
12
  ```
15
13
 
16
- This single command sets up all required configuration files and folders:
17
- - `artifacts/current/` & `artifacts/archived/`
18
- - `artifacts/PLANKIT.md` (Specification)
19
- - `.gemini/instructions.md` (Antigravity binding)
20
- - `.opencode/commands/*.md` (OpenCode Markdown custom commands)
21
- - `.cursorrules` (Cursor rules)
22
- - `AGENTS.md` (Codex / Claude Code universal instructions)
23
-
24
- ---
25
-
26
- ## Global Installation (Optional)
27
-
28
- Install globally using `npm`:
14
+ If installed globally:
29
15
 
30
16
  ```bash
31
17
  npm install -g plankit-cli
18
+ plankit init
19
+ plankit plan my-feature
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ | Command | Action |
25
+ |---|---|
26
+ | `plankit init [--agent <name>]` | Create PlanKit config, artifact folders, spec, and the **selected agent's** folders/commands. Prompts for the agent when none is specified. |
27
+ | `plankit plan <feature> [requirements]` | Create `artifacts/current/<feature>/` with README, phase specs, outputs folder, and state metadata. |
28
+ | `plankit clarify <feature> [phase]` | Create a clarification artifact for requirements and design decisions. |
29
+ | `plankit implement <feature> <phase>` | Validate phase context and prepare `outputs/phase-N-output.md`. |
30
+ | `plankit review <feature>` | Run verification commands, mark the README archived, and move the feature to `artifacts/archived/`. |
31
+ | `plankit status [--json]` | List active and archived features. |
32
+ | `plankit archive <feature>` | Move a feature to archived without running verification. |
33
+
34
+ ## Customization
35
+
36
+ `plankit init` creates `plankit.config.json`. By default **only one agent** is installed — the one you select (interactively, via `--agent`, or the default `opencode`).
37
+
38
+ ```json
39
+ {
40
+ "artifactsDir": "artifacts",
41
+ "overwrite": "skip",
42
+ "agents": {
43
+ "default": "opencode"
44
+ },
45
+ "defaultPhases": [
46
+ {
47
+ "title": "Foundation & Setup",
48
+ "slug": "foundation",
49
+ "objective": "Establish the base structure, constraints, and integration points.",
50
+ "tasks": ["Confirm scope and constraints", "Prepare base structure"]
51
+ }
52
+ ],
53
+ "verification": {
54
+ "testCommand": "npm test",
55
+ "buildCommand": "npm run build"
56
+ },
57
+ "templatesDir": null
58
+ }
32
59
  ```
33
60
 
34
- Then run anywhere:
61
+ Useful options:
35
62
 
36
63
  ```bash
37
- plankit init
38
- plankit plan <feature-name>
39
- plankit status
40
- plankit archive <feature-name>
64
+ plankit init --agent opencode
65
+ plankit init --agent gemini --global-gemini-skills
66
+ plankit init --force
67
+ plankit plan my-feature --phases 4
68
+ plankit plan my-feature --phases "Design,Build,Test"
69
+ plankit review my-feature --test-command "pnpm test" --build-command "pnpm build"
70
+ plankit review my-feature --skip-build
71
+ plankit status --json
41
72
  ```
42
73
 
43
- ---
74
+ ### Agent selection
44
75
 
45
- ## Commands Summary
76
+ `plankit init` installs **only** the folders/commands for the agent you select. Supported agents:
46
77
 
47
- | Command | Action |
78
+ | Agent | What is copied |
48
79
  |---|---|
49
- | `plankit init` | Scaffolds PlanKit configs & folders in the current directory. |
50
- | `plankit plan <feature>` | Scaffolds a new feature workspace under `artifacts/current/<feature>/`. |
51
- | `plankit status` | Lists all active and archived features. |
52
- | `plankit archive <feature>` | Moves a completed feature to `artifacts/archived/<feature>/`. |
53
-
54
- ---
55
-
56
- ## Publishing to NPM
57
-
58
- To publish this package to the official NPM registry so anyone in the world can run `npx plankit init`:
59
-
60
- 1. Log in to your NPM account:
61
- ```bash
62
- npm login
63
- ```
64
- 2. Navigate to the `packages/plankit` directory:
65
- ```bash
66
- cd packages/plankit
67
- ```
68
- 3. Publish to NPM:
69
- ```bash
70
- npm publish --access public
71
- ```
80
+ | `opencode` (default) | `AGENTS.md`-style slash commands under `.opencode/commands/` |
81
+ | `gemini` / `antigravity` | `.gemini/instructions.md` (plus `--global-gemini-skills` under your profile) |
82
+ | `codex` | `AGENTS.md` |
83
+ | `cursor` | `.cursorrules` |
84
+
85
+ Selection order:
86
+ 1. `--agent <name>` flag (non-interactive / CI).
87
+ 2. A previously configured `agents.default` in `plankit.config.json`.
88
+ 3. An interactive numbered menu (when run in a terminal).
89
+ 4. The `opencode` default announced explicitly so the behavior is never silent.
90
+
91
+ When the Angular command/skill library ships, each agent's `commandBundles` entry installs that agent's `commands/`/`skills/` folder automatically with no CLI changes.
92
+
93
+ ## Template overrides
94
+
95
+ Default templates live in the package `templates/` directory. To override them in a project:
96
+
97
+ 1. Create a directory such as `.plankit/templates`.
98
+ 2. Set `"templatesDir": ".plankit/templates"` in `plankit.config.json`.
99
+ 3. Add files matching the built-in template names, for example:
100
+
101
+ ```text
102
+ .plankit/templates/
103
+ AGENTS.md
104
+ PLANKIT.md
105
+ feature-readme.md
106
+ phase-spec.md
107
+ opencode/
108
+ plankit-plan.md
109
+ ```
110
+
111
+ Supported placeholders use `{{name}}` syntax.
112
+
113
+ ## Verification
114
+
115
+ ```bash
116
+ npm test
117
+ npm pack --dry-run
118
+ ```
package/bin/plankit.js CHANGED
@@ -3,3 +3,4 @@
3
3
  import { runCli } from '../src/cli.js';
4
4
 
5
5
  runCli(process.argv.slice(2));
6
+
package/package.json CHANGED
@@ -1,12 +1,21 @@
1
1
  {
2
2
  "name": "plankit-cli",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "PlanKit Command Suite CLI for AI Coding Assistants (Antigravity, OpenCode, Codex, Cursor)",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
7
7
  "plankit": "bin/plankit.js"
8
8
  },
9
9
  "type": "module",
10
+ "files": [
11
+ "bin",
12
+ "src",
13
+ "templates",
14
+ "README.md"
15
+ ],
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
10
19
  "scripts": {
11
20
  "start": "node bin/plankit.js",
12
21
  "test": "node --test"
package/src/agents.js ADDED
@@ -0,0 +1,98 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+
4
+ export const DEFAULT_AGENT = 'opencode';
5
+
6
+ export const AGENT_ORDER = ['opencode', 'gemini', 'codex', 'cursor'];
7
+
8
+ export const GEMINI_SKILL_ENTRIES = [
9
+ ['plankit', 'PlanKit Command Suite master skill.'],
10
+ ['plankit-plan', 'Initialize a feature workspace.'],
11
+ ['plankit-clarify', 'Analyze requirements and ask targeted clarifying questions.'],
12
+ ['plankit-implement', 'Prepare phase implementation context and output artifacts.'],
13
+ ['plankit-review', 'Run verification and archive completed features.']
14
+ ];
15
+
16
+ export const AGENT_DESCRIPTIONS = {
17
+ codex: 'Copies the PlanKit Command Suite into AGENTS.md (Codex reads AGENTS.md).',
18
+ cursor: 'Copies the PlanKit rules into .cursorrules for Cursor AI.',
19
+ opencode: 'Installs the PlanKit slash commands into .opencode/commands/ for OpenCode.',
20
+ gemini: 'Installs .gemini/instructions.md and optional global Gemini skills (Antigravity alias).'
21
+ };
22
+
23
+ export const AGENTS = {
24
+ opencode: {
25
+ id: 'opencode',
26
+ label: 'OpenCode',
27
+ description: AGENT_DESCRIPTIONS.opencode,
28
+ aliases: [],
29
+ bindings: [
30
+ { template: 'opencode/plankit.md', dest: ['.opencode', 'commands', 'plankit.md'] },
31
+ { template: 'opencode/plankit-plan.md', dest: ['.opencode', 'commands', 'plankit-plan.md'] },
32
+ { template: 'opencode/plankit-clarify.md', dest: ['.opencode', 'commands', 'plankit-clarify.md'] },
33
+ { template: 'opencode/plankit-implement.md', dest: ['.opencode', 'commands', 'plankit-implement.md'] },
34
+ { template: 'opencode/plankit-review.md', dest: ['.opencode', 'commands', 'plankit-review.md'] }
35
+ ],
36
+ commandBundles: ['opencode-angular'],
37
+ globalSkillEntries: null
38
+ },
39
+ gemini: {
40
+ id: 'gemini',
41
+ label: 'Antigravity / Gemini',
42
+ description: AGENT_DESCRIPTIONS.gemini,
43
+ aliases: ['antigravity'],
44
+ bindings: [
45
+ { template: 'gemini-instructions.md', dest: ['.gemini', 'instructions.md'] }
46
+ ],
47
+ commandBundles: ['gemini-angular'],
48
+ globalSkillEntries: GEMINI_SKILL_ENTRIES
49
+ },
50
+ codex: {
51
+ id: 'codex',
52
+ label: 'Codex',
53
+ description: AGENT_DESCRIPTIONS.codex,
54
+ aliases: [],
55
+ bindings: [
56
+ { template: 'AGENTS.md', dest: ['AGENTS.md'] }
57
+ ],
58
+ commandBundles: ['codex-angular'],
59
+ globalSkillEntries: null
60
+ },
61
+ cursor: {
62
+ id: 'cursor',
63
+ label: 'Cursor',
64
+ description: AGENT_DESCRIPTIONS.cursor,
65
+ aliases: [],
66
+ bindings: [
67
+ { template: 'cursorrules', dest: ['.cursorrules'] }
68
+ ],
69
+ commandBundles: ['cursor-angular'],
70
+ globalSkillEntries: null
71
+ }
72
+ };
73
+
74
+ export function listAgents() {
75
+ return AGENT_ORDER.map((id) => AGENTS[id]);
76
+ }
77
+
78
+ export function validAgentNames() {
79
+ return AGENT_ORDER.map((id) => AGENTS[id].aliases.concat(id)).flat().join(', ');
80
+ }
81
+
82
+ export function getAgent(input) {
83
+ const name = String(input).trim().toLowerCase();
84
+ if (!name) {
85
+ return null;
86
+ }
87
+ for (const id of AGENT_ORDER) {
88
+ const agent = AGENTS[id];
89
+ if (id === name || agent.aliases.includes(name)) {
90
+ return agent;
91
+ }
92
+ }
93
+ throw new Error(`Unknown agent "${input}". Valid agents: ${validAgentNames()}.`);
94
+ }
95
+
96
+ export function agentBindingsExist(agent) {
97
+ return Array.isArray(agent.bindings) && agent.bindings.length > 0;
98
+ }