coherence-cli 0.2.0 → 0.3.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,3 +1,4 @@
1
+ <!-- AUTO-GENERATED from README.template.md. Edit the template, not this file. -->
1
2
  # coherence-cli
2
3
 
3
4
  **Every idea deserves a trail. Every contributor deserves credit.**
@@ -0,0 +1,165 @@
1
+ # coherence-cli
2
+
3
+ **Every idea deserves a trail. Every contributor deserves credit.**
4
+
5
+ `cc` is the command-line interface for [Coherence Network](https://coherencycoin.com) — an open intelligence platform that traces every idea from inception to payout, with fair attribution, coherence scoring, and federated trust.
6
+
7
+ ```
8
+ npm i -g coherence-cli
9
+ cc status
10
+ ```
11
+
12
+ That's it. You're connected to the live network. No account, no signup, no API key needed for reading.
13
+
14
+ ---
15
+
16
+ ## Why this exists
17
+
18
+ Most ideas die in the gap between "great thought" and "shipped thing." The people who research, prototype, review, document, and maintain rarely see proportional credit.
19
+
20
+ Coherence Network changes that. It tracks the full lifecycle:
21
+
22
+ <!-- include: docs/shared/lifecycle-diagram.md -->
23
+
24
+ `cc` gives you direct access to all of it from your terminal.
25
+
26
+ ---
27
+
28
+ ## Quick start
29
+
30
+ ### See what's happening
31
+
32
+ ```bash
33
+ cc ideas # Browse the portfolio ranked by ROI
34
+ cc resonance # What's alive right now
35
+ cc status # Network health, node count, your identity
36
+ ```
37
+
38
+ ### Go deeper
39
+
40
+ ```bash
41
+ cc idea <id> # Full scores, open questions, value gaps
42
+ cc specs # Feature specs with ROI metrics
43
+ cc spec <id> # Implementation summary, pseudocode, cost
44
+ ```
45
+
46
+ ### Contribute
47
+
48
+ ```bash
49
+ cc share # Submit a new idea (interactive)
50
+ cc stake <id> 10 # Stake 10 CC on an idea you believe in
51
+ cc fork <id> # Fork an idea and take it a new direction
52
+ cc contribute # Record any contribution (code, docs, review, design, community)
53
+ ```
54
+
55
+ ### Identity — bring your own
56
+
57
+ Link any identity you already have. No new accounts. 37 providers across 6 categories.
58
+
59
+ ```bash
60
+ cc identity setup # Guided onboarding (first time)
61
+ cc identity link github alice-dev # Link your GitHub
62
+ cc identity link ethereum 0xabc... # Link your wallet
63
+ cc identity link discord user#1234 # Link Discord
64
+ cc identity # See all your linked accounts
65
+ cc identity lookup github alice-dev # Find anyone by their handle
66
+ ```
67
+
68
+ **Supported providers:**
69
+
70
+ <!-- include: docs/shared/identity-providers.md -->
71
+
72
+ You don't need to register anywhere. Just link a provider and start contributing — your work is attributed to your identity across the entire network.
73
+
74
+ ---
75
+
76
+ ## How coherence scoring works
77
+
78
+ <!-- include: docs/shared/coherence-scoring.md -->
79
+
80
+ ---
81
+
82
+ ## The five pillars
83
+
84
+ | Pillar | In practice |
85
+ |--------|-------------|
86
+ | **Traceability** | `cc idea <id>` traces from spark to payout. Nothing is lost. |
87
+ | **Trust** | Coherence scores replace subjective judgement with measurable quality. |
88
+ | **Freedom** | Fork any idea. Run your own node. Vote on governance. No gatekeepers. |
89
+ | **Uniqueness** | Every idea, spec, and contribution is uniquely identified and ranked. |
90
+ | **Collaboration** | Multi-contributor attribution with coherence-weighted payouts. Fair by design. |
91
+
92
+ ---
93
+
94
+ ## The Coherence Network ecosystem
95
+
96
+ Every part of the network links to every other. Jump in wherever makes sense for you.
97
+
98
+ | Surface | What it is | Link |
99
+ |---------|-----------|------|
100
+ | **Web** | The main site — browse ideas, specs, and contributors visually | [coherencycoin.com](https://coherencycoin.com) |
101
+ | **API** | 100+ endpoints, full OpenAPI docs, the engine behind everything | [api.coherencycoin.com/docs](https://api.coherencycoin.com/docs) |
102
+ | **CLI** | This package — terminal-first access to the full network | [npm: coherence-cli](https://www.npmjs.com/package/coherence-cli) |
103
+ | **MCP Server** | 20 typed tools for AI agents (Claude, Cursor, Windsurf, etc.) | [npm: coherence-mcp-server](https://www.npmjs.com/package/coherence-mcp-server) |
104
+ | **OpenClaw Skill** | Auto-triggers in any OpenClaw instance when you mention ideas, specs, or coherence | [ClawHub: coherence-network](https://clawhub.com/skills/coherence-network) |
105
+ | **GitHub** | Source code, specs, issues, and contribution tracking | [github.com/seeker71/Coherence-Network](https://github.com/seeker71/Coherence-Network) |
106
+
107
+ ---
108
+
109
+ ## Configuration
110
+
111
+ By default, `cc` talks to the public API at `https://api.coherencycoin.com`. Override with environment variables:
112
+
113
+ ```bash
114
+ # Point to a local node
115
+ export COHERENCE_API_URL=http://localhost:8000
116
+
117
+ # Enable write operations
118
+ export COHERENCE_API_KEY=your-key
119
+ ```
120
+
121
+ Config is stored in `~/.coherence-network/config.json`.
122
+
123
+ ---
124
+
125
+ ## All commands
126
+
127
+ ```
128
+ cc help Show all commands
129
+ cc ideas [limit] Browse ideas by ROI
130
+ cc idea <id> View idea detail with scores
131
+ cc specs [limit] List feature specs
132
+ cc spec <id> View spec detail
133
+ cc share Submit a new idea
134
+ cc stake <id> <cc> Stake CC on an idea
135
+ cc fork <id> Fork an idea
136
+ cc contribute Record any contribution
137
+ cc resonance What's alive right now
138
+ cc status Network health + node info
139
+ cc identity Show linked accounts
140
+ cc identity setup Guided identity onboarding
141
+ cc identity link <provider> <id> Link a provider identity
142
+ cc identity unlink <provider> Unlink a provider
143
+ cc identity lookup <provider> <id> Find contributor by identity
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Get involved
149
+
150
+ Coherence Network is open source. Every contribution is tracked and attributed — yours will be too.
151
+
152
+ The simplest way to start:
153
+
154
+ ```bash
155
+ cc ideas # find something interesting
156
+ cc contribute # record what you did
157
+ ```
158
+
159
+ Or explore any part of the ecosystem from the table above. Every surface leads to every other.
160
+
161
+ ---
162
+
163
+ ## License
164
+
165
+ MIT
package/bin/cc.mjs CHANGED
@@ -7,29 +7,34 @@
7
7
  * Zero dependencies. Node 18+ required.
8
8
  */
9
9
 
10
- import { listIdeas, showIdea, shareIdea, stakeOnIdea, forkIdea } from "../lib/commands/ideas.mjs";
10
+ import { listIdeas, showIdea, shareIdea, stakeOnIdea, forkIdea, createIdea } from "../lib/commands/ideas.mjs";
11
11
  import { listSpecs, showSpec } from "../lib/commands/specs.mjs";
12
12
  import { contribute } from "../lib/commands/contribute.mjs";
13
13
  import { showStatus, showResonance } from "../lib/commands/status.mjs";
14
- import { showIdentity, linkIdentity, unlinkIdentity, lookupIdentity, setupIdentity } from "../lib/commands/identity.mjs";
14
+ import { showIdentity, linkIdentity, unlinkIdentity, lookupIdentity, setupIdentity, setIdentity } from "../lib/commands/identity.mjs";
15
15
 
16
16
  const [command, ...args] = process.argv.slice(2);
17
17
 
18
18
  const COMMANDS = {
19
19
  ideas: () => listIdeas(args),
20
- idea: () => showIdea(args),
20
+ idea: () => handleIdea(args),
21
21
  share: () => shareIdea(),
22
22
  stake: () => stakeOnIdea(args),
23
23
  fork: () => forkIdea(args),
24
24
  specs: () => listSpecs(args),
25
25
  spec: () => showSpec(args),
26
- contribute: () => contribute(),
26
+ contribute: () => contribute(args),
27
27
  status: () => showStatus(),
28
28
  resonance: () => showResonance(),
29
29
  identity: () => handleIdentity(args),
30
30
  help: () => showHelp(),
31
31
  };
32
32
 
33
+ async function handleIdea(args) {
34
+ if (args[0] === "create") return createIdea(args.slice(1));
35
+ return showIdea(args);
36
+ }
37
+
33
38
  async function handleIdentity(args) {
34
39
  const sub = args[0];
35
40
  const subArgs = args.slice(1);
@@ -38,6 +43,7 @@ async function handleIdentity(args) {
38
43
  case "unlink": return unlinkIdentity(subArgs);
39
44
  case "lookup": return lookupIdentity(subArgs);
40
45
  case "setup": return setupIdentity();
46
+ case "set": return setIdentity(subArgs);
41
47
  default: return showIdentity();
42
48
  }
43
49
  }
@@ -51,20 +57,23 @@ function showHelp() {
51
57
  \x1b[1mExplore:\x1b[0m
52
58
  ideas [limit] Browse ideas by ROI
53
59
  idea <id> View idea detail
60
+ idea create <id> <name> [--desc "..." --value N --cost N --parent <id>]
54
61
  specs [limit] List feature specs
55
62
  spec <id> View spec detail
56
63
  resonance What's alive right now
57
64
  status Network health + node info
58
65
 
59
66
  \x1b[1mContribute:\x1b[0m
60
- share Submit a new idea
67
+ share Submit a new idea (interactive)
68
+ contribute Record contribution (interactive)
69
+ contribute --type code --cc 5 --idea <id> --desc "what I did"
61
70
  stake <id> <cc> Stake CC on an idea
62
71
  fork <id> Fork an idea
63
- contribute Record any contribution
64
72
 
65
73
  \x1b[1mIdentity:\x1b[0m
66
74
  identity Show your linked accounts
67
75
  identity setup Guided onboarding
76
+ identity set <id> Set identity non-interactively
68
77
  identity link <p> <id> Link a provider (github, discord, ethereum, ...)
69
78
  identity unlink <p> Unlink a provider
70
79
  identity lookup <p> <id> Find contributor by identity
@@ -1,14 +1,59 @@
1
1
  /**
2
2
  * Contribute command — record any contribution.
3
+ *
4
+ * Interactive: cc contribute
5
+ * Non-interactive (for agents):
6
+ * cc contribute --type code --cc 5 --idea <id> --desc "what I did"
3
7
  */
4
8
 
5
9
  import { post } from "../api.mjs";
6
10
  import { ensureIdentity } from "../identity.mjs";
7
- import { createInterface } from "node:readline/promises";
8
- import { stdin, stdout } from "node:process";
11
+ import { getContributorId } from "../config.mjs";
9
12
 
10
- export async function contribute() {
13
+ function parseFlags(args) {
14
+ const flags = {};
15
+ for (let i = 0; i < args.length; i++) {
16
+ if (args[i] === "--type" && args[i + 1]) flags.type = args[++i];
17
+ else if (args[i] === "--cc" && args[i + 1]) flags.cc = parseFloat(args[++i]);
18
+ else if (args[i] === "--idea" && args[i + 1]) flags.idea = args[++i];
19
+ else if (args[i] === "--desc" && args[i + 1]) flags.desc = args[++i];
20
+ }
21
+ return flags;
22
+ }
23
+
24
+ export async function contribute(args = []) {
25
+ const flags = parseFlags(args);
26
+ const hasFlags = flags.type || flags.cc || flags.idea || flags.desc;
27
+
28
+ if (hasFlags) {
29
+ // Non-interactive mode (for agents and scripts)
30
+ const contributor = getContributorId() || process.env.COHERENCE_CONTRIBUTOR || "anonymous";
31
+ const type = flags.type || "other";
32
+ const amount = flags.cc || 1.0;
33
+ const ideaId = flags.idea || undefined;
34
+ const description = flags.desc || "";
35
+
36
+ const result = await post("/api/contributions/record", {
37
+ contributor_id: contributor,
38
+ type,
39
+ amount_cc: amount,
40
+ idea_id: ideaId,
41
+ metadata: { description },
42
+ });
43
+
44
+ if (result) {
45
+ console.log(`\x1b[32m✓\x1b[0m ${type} ${amount} CC${ideaId ? ` → ${ideaId}` : ""}${description ? ` (${description})` : ""}`);
46
+ } else {
47
+ console.log("Failed to record contribution.");
48
+ process.exit(1);
49
+ }
50
+ return;
51
+ }
52
+
53
+ // Interactive mode
11
54
  const contributor = await ensureIdentity();
55
+ const { createInterface } = await import("node:readline/promises");
56
+ const { stdin, stdout } = await import("node:process");
12
57
  const rl = createInterface({ input: stdin, output: stdout });
13
58
 
14
59
  console.log();
@@ -136,3 +136,44 @@ export async function forkIdea(args) {
136
136
  console.log("Fork failed.");
137
137
  }
138
138
  }
139
+
140
+ /**
141
+ * Non-interactive idea creation for agents and scripts.
142
+ *
143
+ * Usage: cc idea create <id> <name> [--desc "..."] [--value N] [--cost N] [--parent <id>]
144
+ */
145
+ export async function createIdea(args) {
146
+ if (args.length < 2) {
147
+ console.log("Usage: cc idea create <id> <name> [--desc \"...\"] [--value N] [--cost N] [--parent <id>]");
148
+ return;
149
+ }
150
+
151
+ const id = args[0];
152
+ const name = args[1];
153
+ const flags = {};
154
+ for (let i = 2; i < args.length; i++) {
155
+ if (args[i] === "--desc" && args[i + 1]) flags.desc = args[++i];
156
+ else if (args[i] === "--value" && args[i + 1]) flags.value = parseFloat(args[++i]);
157
+ else if (args[i] === "--cost" && args[i + 1]) flags.cost = parseFloat(args[++i]);
158
+ else if (args[i] === "--parent" && args[i + 1]) flags.parent = args[++i];
159
+ else if (args[i] === "--confidence" && args[i + 1]) flags.confidence = parseFloat(args[++i]);
160
+ }
161
+
162
+ const body = {
163
+ id,
164
+ name,
165
+ description: flags.desc || name,
166
+ potential_value: flags.value || 50,
167
+ estimated_cost: flags.cost || 5,
168
+ confidence: flags.confidence || 0.5,
169
+ };
170
+ if (flags.parent) body.parent_idea_id = flags.parent;
171
+
172
+ const result = await post("/api/ideas", body);
173
+ if (result) {
174
+ console.log(`\x1b[32m✓\x1b[0m Idea created: ${result.id || id}`);
175
+ } else {
176
+ console.log("Failed to create idea.");
177
+ process.exit(1);
178
+ }
179
+ }
@@ -86,6 +86,18 @@ export async function lookupIdentity(args) {
86
86
  }
87
87
  }
88
88
 
89
+ export async function setIdentity(args) {
90
+ const id = args[0];
91
+ if (!id) {
92
+ console.log("Usage: cc identity set <contributor_id>");
93
+ console.log("Sets the contributor identity non-interactively (for agents and scripts).");
94
+ return;
95
+ }
96
+ const { saveConfig } = await import("../config.mjs");
97
+ saveConfig({ contributor_id: id });
98
+ console.log(`\x1b[32m✓\x1b[0m Identity set to: ${id}`);
99
+ }
100
+
89
101
  export async function setupIdentity() {
90
102
  // Force re-run onboarding
91
103
  await ensureIdentity();
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "coherence-cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Coherence Network CLI — trace ideas from inception to payout, with fair attribution, coherence scoring, and 37 identity providers. No signup needed.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "cc": "bin/cc.mjs"
7
+ "cc": "bin/cc.mjs",
8
+ "coh": "bin/cc.mjs",
9
+ "coherence": "bin/cc.mjs"
8
10
  },
9
11
  "engines": {
10
12
  "node": ">=18.0.0"