{"_id":"@bitxenia/astrawiki-cli","_rev":"2-859c6b90bdf7a3fa7b3005dcae7c3caf","name":"@bitxenia/astrawiki-cli","dist-tags":{"latest":"0.0.12"},"versions":{"0.0.1":{"name":"@bitxenia/astrawiki-cli","version":"0.0.1","keywords":[],"author":"","license":"MIT","_id":"@bitxenia/astrawiki-cli@0.0.1","maintainers":[{"name":"jm-velazquez","email":"jvelazquez@fi.uba.ar"},{"name":"pradajoaquin","email":"joaquiprada@gmail.com"},{"name":"bitxeniabot","email":"bitxeniabot@gmail.com"},{"name":"sotlucas","email":"lucasnsotelog@gmail.com"}],"bin":{"astrawiki":"dist/client/index.js"},"dist":{"shasum":"9febb1aabac2b7efbde35b510da62d7d100e408f","tarball":"https://registry.npmjs.org/@bitxenia/astrawiki-cli/-/astrawiki-cli-0.0.1.tgz","fileCount":5459,"integrity":"sha512-7Bd+iNnuktv8FVLNHXdxazYXRsbMdU4wGQSVfyvwY3pKpnSOTnBdTFDaL1YLkyztmFFJAx54LpGHVLL/Nrsy3g==","signatures":[{"sig":"MEUCIQDPlDSCs9P4c7/JhMkb1+VgKjS+eQ9d1C0u2lEXbJC4kQIgU3YQDbIWugHwFZ3NR9qmb7ZkRbDuIgJB1kUssNmVHgY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5429958},"main":"dist/index.js","type":"module","types":"./dist/index.d.ts","gitHead":"da84be1e3845d29d3324bf00c5abdc65311964c6","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc","clean":"rm -rf data orbitdb"},"_npmUser":{"name":"jm-velazquez","email":"jvelazquez@fi.uba.ar"},"_npmVersion":"10.9.0","description":"This is a command-line interface to manage an astrawiki node. It runs a background service to help pin articles and offers tools for creating, updating, and reading wiki content — either locally or via Docker.","directories":{},"_nodeVersion":"22.12.0","dependencies":{"ora":"^8.2.0","axios":"^1.8.4","chalk":"^5.4.1","express":"^5.1.0","commander":"^13.1.0","datastore-fs":"^10.0.2","blockstore-fs":"^2.0.2","@bitxenia/astrawiki":"^0.0.15"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/express":"^5.0.1"},"_npmOperationalInternal":{"tmp":"tmp/astrawiki-cli_0.0.1_1744310736661_0.8884448946520611","host":"s3://npm-registry-packages-npm-production"}},"0.0.12":{"name":"@bitxenia/astrawiki-cli","description":"Command-line interface to manage an Astrawiki node.","version":"0.0.12","main":"dist/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"tsc","clean":"rm -rf data orbitdb","docker-push":"docker build --tag bitxenia/astrawiki-cli . && docker push bitxenia/astrawiki-cli"},"bin":{"astrawiki":"dist/client/index.js"},"type":"module","keywords":[],"author":"","license":"MIT","dependencies":{"@bitxenia/astrawiki":"0.1.21","axios":"^1.8.4","blockstore-fs":"^2.0.2","chalk":"^5.4.1","commander":"^13.1.0","datastore-fs":"^10.0.2","express":"^5.1.0","ora":"^8.2.0"},"devDependencies":{"@types/express":"^5.0.1","typescript":"^5.8.3"},"_id":"@bitxenia/astrawiki-cli@0.0.12","gitHead":"95a63acf765604d20f5422e2feb69a1ac1499746","_nodeVersion":"23.6.1","_npmVersion":"11.3.0","dist":{"integrity":"sha512-HQGpZ6p8UFz2DdtE/BWORXtDaxjVmed+gyHUQl07vtT6E7oIQ8NlmMHLtl6pVRiYGb8GGCZFvJUE8qzZqXLh1w==","shasum":"cd81234f59a5b840f2796161697165af03d2be78","tarball":"https://registry.npmjs.org/@bitxenia/astrawiki-cli/-/astrawiki-cli-0.0.12.tgz","fileCount":5,"unpackedSize":8944,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD7tPxYvXSqAqiYfd9wdfmNZWgr1xInAB65ErsHusTQuwIhAMRgIlwwhjnC3SMAIM4cRcxo/kBw6Ncv+U7y9fF66r/Z"}]},"_npmUser":{"name":"pradajoaquin","email":"joaquiprada@gmail.com"},"directories":{},"maintainers":[{"name":"jm-velazquez","email":"jvelazquez@fi.uba.ar"},{"name":"pradajoaquin","email":"joaquiprada@gmail.com"},{"name":"bitxeniabot","email":"bitxeniabot@gmail.com"},{"name":"sotlucas","email":"lucasnsotelog@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/astrawiki-cli_0.0.12_1748404272189_0.8301424131092987"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-10T18:45:36.534Z","modified":"2025-05-28T03:51:12.627Z","0.0.1":"2025-04-10T18:45:37.067Z","0.0.12":"2025-05-28T03:51:12.374Z"},"license":"MIT","keywords":[],"description":"Command-line interface to manage an Astrawiki node.","maintainers":[{"name":"jm-velazquez","email":"jvelazquez@fi.uba.ar"},{"name":"pradajoaquin","email":"joaquiprada@gmail.com"},{"name":"bitxeniabot","email":"bitxeniabot@gmail.com"},{"name":"sotlucas","email":"lucasnsotelog@gmail.com"}],"readme":"# Astrawiki CLI\n\nThis is a command-line interface to manage an astrawiki node. It runs a\nbackground service to help pin articles and offers tools for creating,\nupdating, and reading wiki content — either locally or via Docker.\n\n## Motivation\n\nThe main purpose of this tool is to be able to easily spin up a collaborator\nnode for a wiki. By providing a reasonably straightforward way for a community\nto contribute to their wiki, anyone with access to a terminal can support the\ncommunity they choose.\n\n## Features\n\n- Create a new wiki and pin its articles for all to access.\n- Connect with any existing wiki and help host it by pinning all its articles.\n- Run it in the background as a service.\n\n## Prerequisites\n\nUsers should be familiar with [port\nforwarding](https://en.wikipedia.org/wiki/Port_forwarding) to open the\nneeded ports for other peers to get the articles. It's recommended, but not\nnecessary, that the user is familiar with [IPFS](https://docs.ipfs.tech) and\nspecifically [OrbitDB](https://orbitdb.org).\n\n## Dependencies\n\n- `npm`: for the installation.\n\n## Install\n\nThis tool comes packaged as a Node.js binary, but it also comes with its own\nDocker container.\n\n### Local\n\nTo install it locally, run:\n\n```sh\nnpm install -g @bitxenia/astrawiki-cli\n```\n\nAnd then run `astrawiki -V` to check the installation was successful.\n\n### Docker\n\nThere's a DockerHub Docker image available. To get the image, run:\n\n```sh\ndocker pull bitxenia/astrawiki-cli:latest\n```\n\n### Ports\n\nFor the tool to work as intended, it's necessary to open the ports TCP `40001` and UDP `40001` to your machine. This is the same for containers and local\ninstalls, and enables the IPFS node to communicate with other peers.\n\n## Quick start\n\n```sh\nnpm install -g @bitxenia/astrawiki-cli\n# Starts your wiki given the name an your public IP\nastrawiki start --wikiName \"my-wiki\" --ip \"<your-ip>\"\n\n# Adds an article to the wiki\nastrawiki add \"An article\" \"/path/to/your/article/content\"\n\n# Print the article content\nastrawiki get \"An article\"\n```\n\n## Usage\n\n### CLI\n\n#### Start the service\n\n```sh\nastrawiki start [flags]\n```\n\nThis command starts the service and connects to the network with other\nastrawiki nodes.\n\n#### Add an article\n\n```sh\nastrawiki add <name> [file]\n```\n\nAdds an article to the wiki given the name of the article. The `file` argument\nlets the user choose a file to be the article's content. If `file` isn't\npresent, the tool lets the user write the content of the article from within an\neditor. The editor of choice depends on the `$EDITOR` variable.\n\n#### Get an article\n\n```sh\nastrawiki get <name>\n```\n\nPrints out an article from the wiki, as long as it exists.\n\n#### List all articles\n\n```sh\nastrawiki list\n```\n\nLists all articles in the wiki as a newline separated list.\n\n#### View logs\n\n```sh\nastrawiki logs\n```\n\nThis command shows the current standard output of the service. To view the\nerrors, run:\n\n```sh\nastrawiki logs -e\n```\n\nAlso, you can follow the logs with the `-f` flag. This acts like `tail -f`.\n\n### Container\n\n#### Start the service\n\nTo start the service, run the following:\n\n```sh\ndocker run -p 40001:40001 -p 40001:40001/udp \\\n  -e ASTRAWIKI_WIKI_NAME=\"bitxenia-wiki\" \\\n  -e ASTRAWIKI_PUBLIC_IP=\"0.0.0.0\" \\\n  -e ASTRAWIKI_IS_COLLABORATOR=\"\" \\\n  bitxenia/astrawiki-cli:latest\n```\n\nMake sure to replace the `ASTRAWIKI_PUBLIC_IP` environment variable to your\nactual IPv4 address.\n\n#### Add an article\n\n```sh\ncat ./some-file.txt | docker exec -i astrawiki astrawiki add \"An article\" -\n```\n\nThis has to be done through `stdin`, because passing a path or editing in-place\nis unsupported.\n\n#### Get an article\n\n```sh\ndocker exec -i astrawiki astrawiki get \"An article\"\n```\n\n#### List all articles\n\n```sh\ndocker exec -i astrawiki astrawiki list\n```\n\n### View logs\n\n```sh\ndocker exec -i astrawiki astrawiki logs\n```\n\nOr, to view errors:\n\n```sh\ndocker exec -i astrawiki astrawiki logs -e\n```\n\n### HTTP API\n\nThere's a REST API that's in development, but it still works both in the local\nand the Docker versions after running `astrawiki start`.\n\nAvailable at `http://localhost:31337`, and supports the following\nendpoints:\n\n#### Add an article\n\n```http\nPOST /articles\n```\n\nThis accepts the following body:\n\n```json\n{\n  \"name\": \"<name of the article>\",\n  \"content\": \"<content of the article as a raw string>\"\n}\n```\n\nOn success, the server returns a `201 Created` status code.\n\n#### Get an article\n\n```http\nGET /articles/<name>\n```\n\nThis returns the following body:\n\n```json\n{\n  \"name\": \"<name of the article>\",\n  \"content\": \"<content of the article as a raw string>\"\n}\n```\n\nOn success, the server returns a `200 OK` status code.\n\n#### List all articles\n\n```http\nGET /articles\n```\n\nThis returns the following body:\n\n```json\n{\n  \"articles\": [\n    \"article1\",\n    \"article2\"\n    // ...\n  ]\n}\n```\n\nOn success, the server returns a `200 OK` status code.\n\n#### Get server status\n\n```http\nGET /\n```\n\nThis returns a `200 OK` if the server is running.\n\n## Configuration\n\nFlags can handle the configuration, but the user can also set a config file to\nreuse the same configuration upon start.\n\nPath of the config file:\n\n```sh\n~/.config/astrawiki-cli/config.json\n```\n\nIt consists of a JSON file with all the configurations needed.\n\n### Example structure\n\n```json\n{\n  \"wikiName\": \"<name of the wiki to open>\",\n  \"publicIp\": \"<ipv4 address, must be public>\",\n  \"isCollaborator\": true\n}\n```\n\nThe priority of configuration values is the following:\n\n1. Flags\n2. Config file\n3. Defaults\n\nNote that the IP value is mandatory and doesn't have a default value.\n\n## Collaborating\n\nSetting the `--collaborator` flag when starting the service will pin all the\narticles of the wiki you chose. But what does this mean?\n\nSince IPFS is a decentralized service, it needs users hosting the content\nas opposed to servers. If you want to help your favorite wiki, it's useful to\npin the articles. This means that anytime another user wants to access the\nwiki, they can get the content from you, or any other collaborator. That is, as\nlong as you keep the service running in your machine.\n\n## Development\n\nTo work on this you can follow these steps:\n\n```sh\ngit clone git@github.com:bitxenia/astrawiki-cli.git\ncd astrawiki-cli\nnpm install\nnpm run build\n```\n\nThis installs the dependencies and builds the JS files.\n\n### Testing\n\nPlease make sure you don't have the npm package installed globally first. Just\nin case, you can run:\n\n```sh\nnpm remove -g @bitxenia/astrawiki-cli\n```\n\nTo test the tool locally, you can run:\n\n```sh\nnpm link\n```\n\nThis creates a symlink to the built binary, allowing you to run it from\nanywhere using the `astrawiki` command.\n\n## Limitations\n\n- It doesn't support astrawiki-eth.\n\n## Contributing\n\nFeel free to contribute by adding PRs, commenting, or creating issues.\n\n## License\n\nMIT (LICENSE-MIT / http://opensource.org/licenses/MIT)\n","readmeFilename":"README.md"}